linux/scripts/dtc/libfdt
Gustavo A. R. Silva 5224f79096 treewide: Replace zero-length arrays with flexible-array members
There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].

This code was transformed with the help of Coccinelle:
(next-20220214$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch)

@@
identifier S, member, array;
type T1, T2;
@@

struct S {
  ...
  T1 member;
  T2 array[
- 0
  ];
};

UAPI and wireless changes were intentionally excluded from this patch
and will be sent out separately.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2022-02-17 07:00:39 -06:00
..
fdt_addresses.c scripts/dtc: Update to upstream version v1.5.1-22-gc40aeb60b47a 2019-12-26 15:39:13 -07:00
fdt_empty_tree.c scripts/dtc: Update to upstream version v1.5.0-30-g702c1b6c0e73 2019-06-21 12:53:52 -06:00
fdt_overlay.c scripts/dtc: Update to upstream version v1.6.0-31-gcbca977ea121 2020-10-12 09:58:15 -05:00
fdt_ro.c scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
fdt_rw.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
fdt_strerror.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
fdt_sw.c scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
fdt_wip.c scripts/dtc: Update to upstream version v1.6.0-31-gcbca977ea121 2020-10-12 09:58:15 -05:00
fdt.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
fdt.h treewide: Replace zero-length arrays with flexible-array members 2022-02-17 07:00:39 -06:00
libfdt_env.h scripts/dtc: Update to upstream version v1.5.0-30-g702c1b6c0e73 2019-06-21 12:53:52 -06:00
libfdt_internal.h scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
libfdt.h scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00