[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cc8b81d0-8bfb-4b69-8c48-9224c3bf6b97@embeddedor.com>
Date: Mon, 9 Feb 2026 16:22:44 +0900
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Kees Cook <kees@...nel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Stanislaw Gruszka <stf_xl@...pl>, Johannes Berg <johannes@...solutions.net>,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] iwlegacy: Avoid multiple
-Wflex-array-member-not-at-end warnings
On 2/10/26 07:20, Kees Cook wrote:
> On Mon, Feb 09, 2026 at 03:23:59PM +0900, Gustavo A. R. Silva wrote:
>> Ah yes, I can do this. The only thing is that I'd have to change every
>> place where members in struct il4965_tx_resp are used, e.g.
>>
>> s/frame_count/hdr.frame_count
>
> Hm? No, that's what transparent struct members avoid: there is no
> sub-struct name, the members of the struct are transparently visible in
> the surrounding struct:
Ah yes, that's why it's defined like
+struct il4965_tx_resp {
+ struct il4965_tx_resp_hdr;
/*
* For non-agg: frame status TX_STATUS_*
@@ -2664,7 +2668,8 @@ struct il3945_beacon_notif {
} __packed;
and not like
+struct il4965_tx_resp {
+ struct il4965_tx_resp_hdr hdr;
/*
* For non-agg: frame status TX_STATUS_*
@@ -2664,7 +2668,8 @@ struct il3945_beacon_notif {
} __packed;
>
> struct inside {
> int a;
> int b;
> };
>
> struct foo {
> struct inside;
> int c;
> } *p;
>
> "p->a" is valid.
Yes, gotcha!
>
>> Another thing to take into account (fortunately, not in this case) is
>> when the FAM needs to be annotated with __counted_by(). If we use a
>> separate struct for the header portion of the flexible structure, GCC
>> currently cannot _see_ the _counter_ if it's included in a non-anonymous
>> structure. However, this will be possible in the near future, correct?
>
> Right, that's still in progress. I don't expect it soon, though. :(
>
Okay.
-Gustavo
Powered by blists - more mailing lists