alpha: Replace one-element array with flexible array member
PATCH RESEND 1/1 alpha: Replace one-element array with flexible array member
Replace the deprecated one-element array with a modern flexible array member in the struct crb_struct.
--- arch/alpha/include/asm/hwrpb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/include/asm/hwrpb.h +1 -1
@@ -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 {
Signature · 1 line
2.47.1
Quoted 13 lines · Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct
crb_struct.Signed-off-by Thorsten Blum <[email protected]>--- arch/alpha/include/asm/hwrpb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/alpha/include/asm/hwrpb.h +0
-0
arch/alpha/include/asm/hwrpb.h struct crb_struct { · line 139
Quoted 6 lines
arch/alpha/include/asm/hwrpb.h +1
-1@@ -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:
-Kees
Signature · 1 line
Kees Cook
Quoted 8 lines · Kees Cook
Quoted 5 lines · Thorsten Blum
Replace the deprecated one-element array with a modern flexible array member in the struct
crb_struct.Signed-off-by Thorsten Blum <[email protected]>---
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