From 581445c19b593bfe5ff52533dac411be8118559d Mon Sep 17 00:00:00 2001 From: Dmytro Prokopchuk Date: Mon, 12 Oct 2026 09:42:16 +0200 Subject: [PATCH] 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 Reviewed-by: Jan Beulich --- 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;