[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251024162354.0a94e4b1@kernel.org>
Date: Fri, 24 Oct 2025 16:23:54 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] net: inet_sock.h: Avoid thousands of
-Wflex-array-member-not-at-end warnings
On Fri, 24 Oct 2025 12:24:09 +0100 Gustavo A. R. Silva wrote:
> On 10/24/25 01:25, Jakub Kicinski wrote:
> > On Tue, 21 Oct 2025 12:43:30 +0100 Gustavo A. R. Silva wrote:
> >> struct ip_options_data {
> >> - struct ip_options_rcu opt;
> >> - char data[40];
> >> + TRAILING_OVERLAP(struct ip_options_rcu, opt, opt.__data,
> >> + char data[40];
> >> + );
> >> };
> >
> > Is there a way to reserve space for flexible length array on the stack
> > without resorting to any magic macros? This struct has total of 5 users.
>
> Not that I know of. That's the reason why we had to implement macros like
> TRAILING_OVERLAP(), DEFINE_FLEX(), DEFINE_RAW_FLEX().
>
> Regarding these three macros, the simplest and least intrusive one to use is
> actually TRAILING_OVERLAP(), when the flex-array member is not annotated with
> the counted_by attribute (otherwise, DEFINE_FLEX() would be preferred).
>
> Of course, the most straightforward alternative is to use fixed-size arrays
> if flex arrays are not actually needed.
Honestly, I'm tired of the endless, nasty macros for no clear benefit.
This patch is not happening.
Powered by blists - more mailing lists