Message ID | 80cb7054b82f55f11159faf5f10bfacf44758be0.1718380780.git.alessandro.zucchelli@bugseng.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Address violations of MISRA C:2012 Rule 5.3 | expand |
On 14.06.2024 18:12, Alessandro Zucchelli wrote: > --- a/xen/arch/x86/mm.c > +++ b/xen/arch/x86/mm.c > @@ -4703,7 +4703,7 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) > { > struct xen_foreign_memory_map fmap; > struct domain *d; > - struct e820entry *map; > + struct e820entry *e; What version of the tree is this against? The variable in my copy is named "e820", and it is only then that I could see what the conflict actually is. I can't see any conflict with anything named "map". Saying what the actual conflict is imo also ought to be part if the description. Jan
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 5471b6b1f2..720d56e103 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4703,7 +4703,7 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct xen_foreign_memory_map fmap; struct domain *d; - struct e820entry *map; + struct e820entry *e; if ( copy_from_guest(&fmap, arg, 1) ) return -EFAULT; @@ -4722,23 +4722,23 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return rc; } - map = xmalloc_array(e820entry_t, fmap.map.nr_entries); - if ( map == NULL ) + e = xmalloc_array(e820entry_t, fmap.map.nr_entries); + if ( e == NULL ) { rcu_unlock_domain(d); return -ENOMEM; } - if ( copy_from_guest(map, fmap.map.buffer, fmap.map.nr_entries) ) + if ( copy_from_guest(e, fmap.map.buffer, fmap.map.nr_entries) ) { - xfree(map); + xfree(e); rcu_unlock_domain(d); return -EFAULT; } spin_lock(&d->arch.e820_lock); xfree(d->arch.e820); - d->arch.e820 = map; + d->arch.e820 = e; d->arch.nr_e820 = fmap.map.nr_entries; spin_unlock(&d->arch.e820_lock);
This addresses violations of MISRA C:2012 Rule 5.3 which states as following: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope. No functional change. Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com> --- xen/arch/x86/mm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)