Message ID | 4540a3850dae951dd6bc4f9b001c9816bde2e49e.1702555387.git.maria.celeste.cesario@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen: address violations of MISRA C:2012 Rule 11.8 | expand |
On 14.12.2023 13:07, Simone Ballarin wrote: > --- a/xen/common/version.c > +++ b/xen/common/version.c > @@ -178,7 +178,7 @@ void __init xen_build_init(void) > if ( &n[1] >= __note_gnu_build_id_end ) > return; > > - sz = (void *)__note_gnu_build_id_end - (void *)n; > + sz = (const void *)__note_gnu_build_id_end - (const void *)n; > > rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len); > How does this change fit the subject? I'm also inclined to ask that these casts be changed to unsigned long or uintptr_t. For the actual EFI change: Reviewed-by: Jan Beulich <jbeulich@suse.com> Jan
On Thu, 14 Dec 2023, Simone Ballarin wrote: > From: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com> > > The xen sources contain violations of MISRA C:2012 Rule 11.8 whose > headline states: > "A conversion shall not remove any const, volatile or _Atomic qualification > from the type pointed to by a pointer". > > Add missing const qualifiers in casts. > The variables are originally const-qualified. > There's no reason to drop the qualifiers. > > Signed-off-by: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com> > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/common/efi/boot.c | 6 +++--- > xen/common/version.c | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 6110819918..efbec00af9 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -1248,10 +1248,10 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste > #endif > > /* Adjust pointers into EFI. */ > - efi_ct = (void *)efi_ct + DIRECTMAP_VIRT_START; > - efi_rs = (void *)efi_rs + DIRECTMAP_VIRT_START; > + efi_ct = (const void *)efi_ct + DIRECTMAP_VIRT_START; > + efi_rs = (const void *)efi_rs + DIRECTMAP_VIRT_START; > efi_memmap = (void *)efi_memmap + DIRECTMAP_VIRT_START; > - efi_fw_vendor = (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; > + efi_fw_vendor = (const void *)efi_fw_vendor + DIRECTMAP_VIRT_START; > } > > /* SAF-1-safe */ > diff --git a/xen/common/version.c b/xen/common/version.c > index d320135208..6ac5a52700 100644 > --- a/xen/common/version.c > +++ b/xen/common/version.c > @@ -178,7 +178,7 @@ void __init xen_build_init(void) > if ( &n[1] >= __note_gnu_build_id_end ) > return; > > - sz = (void *)__note_gnu_build_id_end - (void *)n; > + sz = (const void *)__note_gnu_build_id_end - (const void *)n; > > rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len); > > -- > 2.40.0 >
On 14/12/23 17:32, Jan Beulich wrote: > On 14.12.2023 13:07, Simone Ballarin wrote: >> --- a/xen/common/version.c >> +++ b/xen/common/version.c >> @@ -178,7 +178,7 @@ void __init xen_build_init(void) >> if ( &n[1] >= __note_gnu_build_id_end ) >> return; >> >> - sz = (void *)__note_gnu_build_id_end - (void *)n; >> + sz = (const void *)__note_gnu_build_id_end - (const void *)n; >> >> rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len); >> > > How does this change fit the subject? I'm also inclined to ask that these > casts be changed to unsigned long or uintptr_t. > > For the actual EFI change: > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > Jan > Ok, v2 will use uintptr_t.
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 6110819918..efbec00af9 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1248,10 +1248,10 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste #endif /* Adjust pointers into EFI. */ - efi_ct = (void *)efi_ct + DIRECTMAP_VIRT_START; - efi_rs = (void *)efi_rs + DIRECTMAP_VIRT_START; + efi_ct = (const void *)efi_ct + DIRECTMAP_VIRT_START; + efi_rs = (const void *)efi_rs + DIRECTMAP_VIRT_START; efi_memmap = (void *)efi_memmap + DIRECTMAP_VIRT_START; - efi_fw_vendor = (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; + efi_fw_vendor = (const void *)efi_fw_vendor + DIRECTMAP_VIRT_START; } /* SAF-1-safe */ diff --git a/xen/common/version.c b/xen/common/version.c index d320135208..6ac5a52700 100644 --- a/xen/common/version.c +++ b/xen/common/version.c @@ -178,7 +178,7 @@ void __init xen_build_init(void) if ( &n[1] >= __note_gnu_build_id_end ) return; - sz = (void *)__note_gnu_build_id_end - (void *)n; + sz = (const void *)__note_gnu_build_id_end - (const void *)n; rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len);