|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] virtual_region: address Misra C:2012 rule 18.3
commit 581445c19b593bfe5ff52533dac411be8118559d
Author: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Mon Oct 12 09:42:16 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Oct 12 09:42:16 2026 +0200
virtual_region: address Misra C:2012 rule 18.3
find_text_region() tests whether an arbitrary address lies inside
[text_start, text_end). The address and those bounds are not known to
point into one object, so relational operators on the pointers are
undefined behaviour and violate Misra C:2012 rule 18.3.
The bounds are cast to unsigned long because addr already has that
type. The type is wide enough to hold a pointer, so the comparison
result stays the same.
No functional changes.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/common/virtual_region.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c
index 1dc2e9f592..515751b6c3 100644
--- a/xen/common/virtual_region.c
+++ b/xen/common/virtual_region.c
@@ -83,8 +83,8 @@ const struct virtual_region *find_text_region(unsigned long
addr)
rcu_read_lock(&rcu_virtual_region_lock);
list_for_each_entry_rcu ( iter, &virtual_region_list, list )
{
- if ( (void *)addr >= iter->text_start &&
- (void *)addr < iter->text_end )
+ if ( addr >= (unsigned long)iter->text_start &&
+ addr < (unsigned long)iter->text_end )
{
region = iter;
break;
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |