Message ID | 20241220192020.1667-3-thorsten.blum@linux.dev (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [RESEND] alpha: Replace one-element array with flexible array member | expand |
On Fri, Dec 20, 2024 at 08:20:20PM +0100, Thorsten Blum wrote: > Replace the deprecated one-element array with a modern flexible array > member in the struct crb_struct. > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> > --- > arch/alpha/include/asm/hwrpb.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/alpha/include/asm/hwrpb.h b/arch/alpha/include/asm/hwrpb.h > index fc76f36265ad..db831cf8de10 100644 > --- a/arch/alpha/include/asm/hwrpb.h > +++ b/arch/alpha/include/asm/hwrpb.h > @@ -135,7 +135,7 @@ struct crb_struct { > /* virtual->physical map */ > unsigned long map_entries; > unsigned long map_pages; > - struct vf_map_struct map[1]; > + struct vf_map_struct map[]; > }; Seems like this could use __counted_by(map_entries) as well? ... for (i = 0; i < crb->map_entries; ++i) { unsigned long pfn = crb->map[i].pa >> PAGE_SHIFT; ... But yes, this appears to be used as a flexible array and should be adjusted. I see no sizeof() uses that would change. So: Reviewed-by: Kees Cook <kees@kernel.org> -Kees
On 23. Dec 2024, at 06:46, Kees Cook wrote: > On Fri, Dec 20, 2024 at 08:20:20PM +0100, Thorsten Blum wrote: >> Replace the deprecated one-element array with a modern flexible array >> member in the struct crb_struct. >> >> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> >> --- > > Seems like this could use __counted_by(map_entries) as well? Yes, but alpha doesn't seem to support __counted_by() yet. Does it still make sense to add it then? Thanks, Thorsten
diff --git a/arch/alpha/include/asm/hwrpb.h b/arch/alpha/include/asm/hwrpb.h index fc76f36265ad..db831cf8de10 100644 --- a/arch/alpha/include/asm/hwrpb.h +++ b/arch/alpha/include/asm/hwrpb.h @@ -135,7 +135,7 @@ struct crb_struct { /* virtual->physical map */ unsigned long map_entries; unsigned long map_pages; - struct vf_map_struct map[1]; + struct vf_map_struct map[]; }; struct memclust_struct {
Replace the deprecated one-element array with a modern flexible array member in the struct crb_struct. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> --- arch/alpha/include/asm/hwrpb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)