Skip to content

Commit 7b191b9

Browse files
GustavoARSilvatsbogend
authored andcommitted
MIPS: dec: prom: Address -Warray-bounds warning
Zero-length arrays are deprecated, and we are replacing them with flexible array members instead. So, replace zero-length array with flexible-array member in struct memmap. Address the following warning found after building (with GCC-13) mips64 with decstation_64_defconfig: In function 'rex_setup_memory_region', inlined from 'prom_meminit' at arch/mips/dec/prom/memory.c:91:3: arch/mips/dec/prom/memory.c:72:31: error: array subscript i is outside array bounds of 'unsigned char[0]' [-Werror=array-bounds=] 72 | if (bm->bitmap[i] == 0xff) | ~~~~~~~~~~^~~ In file included from arch/mips/dec/prom/memory.c:16: ./arch/mips/include/asm/dec/prom.h: In function 'prom_meminit': ./arch/mips/include/asm/dec/prom.h:73:23: note: while referencing 'bitmap' 73 | unsigned char bitmap[0]; This helps with the ongoing efforts to globally enable -Warray-bounds. This results in no differences in binary output. Link: KSPP#79 Link: KSPP#323 Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 944520f commit 7b191b9

File tree

1 file changed

+1
-1
lines changed
  • arch/mips/include/asm/dec

1 file changed

+1
-1
lines changed

arch/mips/include/asm/dec/prom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static inline bool prom_is_rex(u32 magic)
7070
*/
7171
typedef struct {
7272
int pagesize;
73-
unsigned char bitmap[0];
73+
unsigned char bitmap[];
7474
} memmap;
7575

7676

0 commit comments

Comments
 (0)