Re: [PATCH][next] treewide: Replace zero-length arrays with flexible-array members
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Kees Cook <keescook@xxxxxxxxxxxx>
- Subject: Re: [PATCH][next] treewide: Replace zero-length arrays with flexible-array members
- From: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
- Date: Tue, 15 Feb 2022 13:21:10 -0600
- Cc: GR-QLogic-Storage-Upstream@xxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, nouveau@xxxxxxxxxxxxxxxxxxxxx, coresight@xxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, bcm-kernel-feedback-list@xxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, linux-omap@xxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, target-devel@xxxxxxxxxxxxxxx, mpi3mr-linuxdrv.pdl@xxxxxxxxxxxx, linux-staging@xxxxxxxxxxxxxxx, linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx, sparmaintainer@xxxxxxxxxx, linux-cifs@xxxxxxxxxxxxxxx, samba-technical@xxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx, devel@xxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, greybus-dev@xxxxxxxxxxxxxxxx, linux-i3c@xxxxxxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, linux-bluetooth@xxxxxxxxxxxxxxx, alsa-devel@xxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, linux-hardening@xxxxxxxxxxxxxxx
- In-reply-to: <202202151016.C0471D6E@keescook>
- References: <20220215174743.GA878920@embeddedor> <202202151016.C0471D6E@keescook>
On Tue, Feb 15, 2022 at 10:17:40AM -0800, Kees Cook wrote:
> On Tue, Feb 15, 2022 at 11:47:43AM -0600, Gustavo A. R. Silva wrote:
> > 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
> > ];
> > };
>
> These all look trivially correct to me. Only two didn't have the end of
> the struct visible in the patch, and checking those showed them to be
> trailing members as well, so:
>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
I'll add this to my -next tree.
Thanks!
--
Gustavo
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]