mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@epam.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
c161c11875
commit
581445c19b
1 file changed
+2
-2
@@ -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;
|
||||
|
||||