Browse Source

libfdt: Replace deprecated 0-length arrays with proper flexible arrays

Replace the 0-length arrays in structures with proper flexible
arrays. This will avoid warnings when building under GCC 13 with
-fstrict-flex-arrays, which the Linux kernel will be doing soon:

In file included from ../lib/fdt_ro.c:2:
../lib/../scripts/dtc/libfdt/fdt_ro.c: In function 'fdt_get_name':
../lib/../scripts/dtc/libfdt/fdt_ro.c:319:24: warning: 'strrchr' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
  319 |                 leaf = strrchr(nameptr, '/');
      |                        ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Kees Cook 2 years ago committed by David Gibson
parent
commit
a41509bea3
  1. 4
      libfdt/fdt.h

4
libfdt/fdt.h

@ -35,14 +35,14 @@ struct fdt_reserve_entry {


struct fdt_node_header { struct fdt_node_header {
fdt32_t tag; fdt32_t tag;
char name[0]; char name[];
}; };


struct fdt_property { struct fdt_property {
fdt32_t tag; fdt32_t tag;
fdt32_t len; fdt32_t len;
fdt32_t nameoff; fdt32_t nameoff;
char data[0]; char data[];
}; };


#endif /* !__ASSEMBLY */ #endif /* !__ASSEMBLY */

Loading…
Cancel
Save