Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 10:54:58AM -0700, Kees Cook wrote: > which must also be assuming it's a header. So probably better to just > drop the driver_data field? I don't see anything using it (that I can > find) besides as a sanity-check that the field exists and is at the end > of the struct.

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Tue, Jun 28, 2022 at 09:27:21AM +0200, Geert Uytterhoeven wrote: > Hi Gustavo, > > Thanks for your patch! > > On Mon, Jun 27, 2022 at 8:04 PM 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

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Mon, Jun 27, 2022 at 09:40:52PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > > [...] > > Fyi, this breaks BPF CI: > > > > https://github.com/kernel-patches/bpf/runs/7078719372?check_suite_focus=true > > > > [...] > >

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > Though maybe we could just switch off > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > We need to think in a different strategy. I think we will need to switch off the warning in userspace - this is

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Geert Uytterhoeven
Hi Gustavo, Thanks for your patch! On Mon, Jun 27, 2022 at 8:04 PM 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

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Jason Gunthorpe
On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > On 6/27/22 8:04 PM, 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

RE: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Dan Williams
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

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Daniel Borkmann
On 6/27/22 8:04 PM, 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