linux/scripts/dtc
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
..
include-prefixes dts: drop dangling c6x symlink 2021-02-23 21:37:09 -06:00
libfdt treewide: Replace zero-length arrays with flexible-array members 2022-02-17 07:00:39 -06:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
checks.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
data.c scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
dt_to_config treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 473 2019-06-19 17:09:11 +02:00
dtc-lexer.l scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
dtc-parser.y scripts/dtc: Update to upstream version v1.6.0-31-gcbca977ea121 2020-10-12 09:58:15 -05:00
dtc.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
dtc.h scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
dtx_diff scripts/dtc: dtx_diff: remove broken example from help text 2022-01-17 16:26:44 -06:00
fdtget.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
fdtoverlay.c scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
fdtput.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
flattree.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
fstree.c scripts/dtc: Update to upstream version v1.5.1-22-gc40aeb60b47a 2019-12-26 15:39:13 -07:00
livetree.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
Makefile scripts/dtc: Add missing fdtoverlay to gitignore 2021-02-23 14:48:40 -08:00
srcpos.c scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9 2021-02-04 09:00:04 -06:00
srcpos.h scripts/dtc: Update to upstream version v1.5.0-30-g702c1b6c0e73 2019-06-21 12:53:52 -06:00
treesource.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
update-dtc-source.sh scripts: dtc: Fetch fdtoverlay.c from external DTC project 2021-02-03 15:21:44 -06:00
util.c scripts/dtc: Update to upstream version v1.5.1-22-gc40aeb60b47a 2019-12-26 15:39:13 -07:00
util.h scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
version_gen.h scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00
yamltree.c scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 2021-10-29 08:55:38 -05:00