scripts/dtc: Replace 0-length arrays with flexible arrays
PATCH 1/1 scripts/dtc: Replace 0-length arrays with flexible arrays
Replace the 0-length array with a C99 flexible array. Seen with GCC 13 under -fstrict-flex-arrays:
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, '/');
| ^~~~~~~~~~~~~~~~~~~~~--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/dtc/libfdt/fdt.h +2 -2
@@ -35,14 +35,14 @@ struct fdt_reserve_entry {struct fdt_node_header {fdt32_t tag; -char name[0 ]; +char name[]; };struct fdt_property {fdt32_t tag;fdt32_t len;fdt32_t nameoff; -char data[0 ]; +char data[]; };#endif /* !__ASSEMBLY */
Signature · 1 line
2.34.1
Quoted 10 lines · Kees Cook
Replace the 0-length array with a C99 flexible array. Seen with GCC 13 under -fstrict-flex-arrays:
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, '/'); | ^~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines
Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Signed-off-by Kees Cook <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Changes to dtc/libfdt go to upstream dtc first and then we sync them back.
Rob
Quoted 19 lines · Rob Herring
Quoted 10 lines · Kees Cook
Replace the 0-length array with a C99 flexible array. Seen with GCC 13 under -fstrict-flex-arrays:
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, '/'); | ^~~~~~~~~~~~~~~~~~~~~Quoted 7 lines
Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Signed-off-by Kees Cook <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 1 line
Changes to dtc/libfdt go to upstream dtc first and then we sync them back.
Ah-ha, I've found it: https://github.com/dgibson/dtc
Thanks!
Signature · 1 line
Kees Cook
Quoted 20 lines · Kees Cook
Quoted 19 lines · Rob Herring
Quoted 17 lines · Kees Cook
Replace the 0-length array with a C99 flexible array. Seen with GCC 13 under -fstrict-flex-arrays:
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, '/'); | ^~~~~~~~~~~~~~~~~~~~~Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Signed-off-by Kees Cook <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line
Changes to dtc/libfdt go to upstream dtc first and then we sync them back.
Ah-ha, I've found it: https://github.com/dgibson/dtc
Sent upstream: https://github.com/dgibson/dtc/pull/76
Signature · 1 line
Kees Cook
Quoted 22 lines · Kees Cook
Quoted 20 lines · Kees Cook
Quoted 19 lines · Rob Herring
Quoted 17 lines · Kees Cook
Replace the 0-length array with a C99 flexible array. Seen with GCC 13 under -fstrict-flex-arrays:
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, '/'); | ^~~~~~~~~~~~~~~~~~~~~Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Signed-off-by Kees Cook <[email protected]>--- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Changes to dtc/libfdt go to upstream dtc first and then we sync them back.
Ah-ha, I've found it: https://github.com/dgibson/dtc
Sent upstream: https://github.com/dgibson/dtc/pull/76
Maybe David will take that PR, but upstream is here[1]. Patches go to [email protected].
Rob