Message ID | 68e28c7631f1233df1527674cfc27cf3f44797a7.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/arch/x86/boot/reloc.c > +++ b/xen/arch/x86/boot/reloc.c > @@ -300,8 +300,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out) > const struct vesa_mode_info *mi; > > video = _p(video_out); > - ci = (void *)get_mb2_data(tag, vbe, vbe_control_info); > - mi = (void *)get_mb2_data(tag, vbe, vbe_mode_info); > + ci = (const void *)get_mb2_data(tag, vbe, vbe_control_info); > + mi = (const void *)get_mb2_data(tag, vbe, vbe_mode_info); This wasn't and isn't very nice, but I also can't think of a way to improve it, so Acked-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. > > Macro get_mb2_data returns values that are const-qualified. > The results are stored in const struct pointers, hence > there's no need to cast away the const 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>
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index df0bc710a7..77fdb2be05 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -300,8 +300,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out) const struct vesa_mode_info *mi; video = _p(video_out); - ci = (void *)get_mb2_data(tag, vbe, vbe_control_info); - mi = (void *)get_mb2_data(tag, vbe, vbe_mode_info); + ci = (const void *)get_mb2_data(tag, vbe, vbe_control_info); + mi = (const void *)get_mb2_data(tag, vbe, vbe_mode_info); if ( ci->version >= 0x0200 && (mi->attrib & 0x9b) == 0x9b ) {