[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2e93993-e64b-ce7d-88cf-4c367b747e40@embeddedor.com>
Date: Thu, 25 Mar 2021 16:12:28 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: David Laight <David.Laight@...LAB.COM>,
"'Gustavo A. R. Silva'" <gustavoars@...nel.org>,
"J. Bruce Fields" <bfields@...ldses.org>,
Chuck Lever <chuck.lever@...cle.com>
Cc: "linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH][next] UAPI: nfsfh.h: Replace one-element array with
flexible-array member
On 3/25/21 10:29, David Laight wrote:
>>>
>>> Could you use the simpler:
>>>> struct nfs_fhbase_new {
>>>> __u8 fb_version;
>>>> __u8 fb_auth_type;
>>>> __u8 fb_fsid_type;
>>>> __u8 fb_fileid_type;
>>>> union {
>>>> __u32 fb_auth[1];
>>>> __u32 fb_auth_flex[0];
>>>> };
>>>> };
>>>
>>> Although I'm not certain flexible arrays are supported
>>> as the last element of a union.
>>
>> Nope; this is not allowed: https://godbolt.org/z/14vd4o8na
>
> Nothing an extra 'struct {__u32 fb_auth_flex[0]; }'; won't solve.
We don't want to introduce zero-length arrays [1].
--
Gustavo
[1] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays
Powered by blists - more mailing lists