Re: [PATCH v3] ethtool: Replace 0-length array with flexible array
From: Kees Cook
Date: Fri Jan 06 2023 - 15:07:57 EST
On Fri, Jan 06, 2023 at 02:38:18PM +0900, Vincent MAILHOL wrote:
> On Fri. 6 Jan 2023 at 13:28, Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
>
> Side comment, this link does not mention the __DECLARE_FLEX_ARRAY().
> It could be good to add a reference to the helper here. But of course,
> this is not a criticism of this patch.
Good point! I've sent a patch for this now.
> You may want to double check your other patches as well. At least this
> one is also using the helper when not needed:
>
> https://lore.kernel.org/netdev/20230105223642.never.980-kees@xxxxxxxxxx/T/#u
That one does, actually, need it since otherwise the flex array would be
"alone in a struct" which is the other case that C99 irrationally
disallows.
-Kees
--
Kees Cook