Message ID | 807b238780c3e2dfce785c6bb173099a4bd38e4b.1690969271.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86: address some violations of MISRA C:2012 Rule 5.3 | expand |
On Wed, 2 Aug 2023, Nicola Vetrini wrote: > The parameters renamed in the function declaration caused shadowing > with the homonymous variable in 'xen/common/efi/boot.c'. Renaming > them also addresses Rule 8.3: > "All declarations of an object or function shall use the same names > and type qualifiers". > > The local variable 'mask' is removed because it shadows the homonymous > variable defined in an outer scope, with no change to the semantics. > It was introduced by commit 5a771800114c437fb857b44b3ed74f60e87979c2 > as a refactoring of the branch that handles 'CONFIG_X86_64' for function > '__start_xen'. > > No functional changes. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/arch/x86/include/asm/setup.h | 2 +- > xen/arch/x86/setup.c | 3 +-- > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h > index 51fce66607..b0e6a39e23 100644 > --- a/xen/arch/x86/include/asm/setup.h > +++ b/xen/arch/x86/include/asm/setup.h > @@ -33,7 +33,7 @@ static inline void vesa_init(void) {}; > > int construct_dom0( > struct domain *d, > - const module_t *kernel, unsigned long kernel_headroom, > + const module_t *image, unsigned long image_headroom, > module_t *initrd, > const char *cmdline); > void setup_io_bitmap(struct domain *d); > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > index 2dbe9857aa..80ae973d64 100644 > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -1577,8 +1577,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) > s = map_s; > if ( s < map_e ) > { > - uint64_t mask = (1UL << L2_PAGETABLE_SHIFT) - 1; > - > + mask = (1UL << L2_PAGETABLE_SHIFT) - 1; > map_s = (s + mask) & ~mask; > map_e &= ~mask; > init_boot_pages(map_s, map_e); > -- > 2.34.1 >
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h index 51fce66607..b0e6a39e23 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -33,7 +33,7 @@ static inline void vesa_init(void) {}; int construct_dom0( struct domain *d, - const module_t *kernel, unsigned long kernel_headroom, + const module_t *image, unsigned long image_headroom, module_t *initrd, const char *cmdline); void setup_io_bitmap(struct domain *d); diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 2dbe9857aa..80ae973d64 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1577,8 +1577,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) s = map_s; if ( s < map_e ) { - uint64_t mask = (1UL << L2_PAGETABLE_SHIFT) - 1; - + mask = (1UL << L2_PAGETABLE_SHIFT) - 1; map_s = (s + mask) & ~mask; map_e &= ~mask; init_boot_pages(map_s, map_e);
The parameters renamed in the function declaration caused shadowing with the homonymous variable in 'xen/common/efi/boot.c'. Renaming them also addresses Rule 8.3: "All declarations of an object or function shall use the same names and type qualifiers". The local variable 'mask' is removed because it shadows the homonymous variable defined in an outer scope, with no change to the semantics. It was introduced by commit 5a771800114c437fb857b44b3ed74f60e87979c2 as a refactoring of the branch that handles 'CONFIG_X86_64' for function '__start_xen'. No functional changes. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> --- xen/arch/x86/include/asm/setup.h | 2 +- xen/arch/x86/setup.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)