linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] net: inet_sock.h: Avoid thousands of -Wflex-array-member-not-at-end warnings
Date: Fri, 24 Oct 2025 16:23:54 -0700	[thread overview]
Message-ID: <20251024162354.0a94e4b1@kernel.org> (raw)
In-Reply-To: <949f472c-baca-4c2f-af23-7ba76fff1ddc@embeddedor.com>

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.

      reply	other threads:[~2025-10-24 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 11:43 [PATCH][next] net: inet_sock.h: Avoid thousands of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-10-21 15:58 ` Simon Horman
2025-10-24  0:25 ` Jakub Kicinski
2025-10-24 11:24   ` Gustavo A. R. Silva
2025-10-24 23:23     ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251024162354.0a94e4b1@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=horms@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).