Re: [PATCH] RDMA: Replace zero-length array with flexible-array member

From: Jason Gunthorpe
Date: Fri Apr 01 2022 - 07:50:48 EST


On Fri, Apr 01, 2022 at 07:54:06AM +0000, cgel.zte@xxxxxxxxx wrote:
> From: Lv Ruyi <lv.ruyi@xxxxxxxxxx>
>
> 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].

If I recall properly this doesn't work if the flex array is nested
inside another member.. Not sure what this thinks it is doing anyhow

Jason