[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBizeZ5DaBT5KKXN@work>
Date: Mon, 20 Mar 2023 13:26:49 -0600
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Simon Horman <simon.horman@...igine.com>
Cc: Felix Fietkau <nbd@....name>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Ryder Lee <ryder.lee@...iatek.com>,
Shayne Chen <shayne.chen@...iatek.com>,
Sean Wang <sean.wang@...iatek.com>,
Kalle Valo <kvalo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] wifi: mt76: mt7921: Replace fake flex-arrays with
flexible-array members
On Mon, Mar 20, 2023 at 03:56:54PM +0100, Simon Horman wrote:
> > struct mt7921_asar_cl {
> > @@ -85,7 +85,7 @@ struct mt7921_asar_fg {
> > u8 rsvd;
> > u8 nr_flag;
> > u8 rsvd1;
> > - u8 flag[0];
> > + u8 flag[];
>
> I am curious to know why DECLARE_FLEX_ARRAY isn't used here.
In contrast to the other structs, there is no object of type struct
mt7921_asar_fg declared in a union:
91 struct mt7921_acpi_sar {
92 u8 ver;
93 union {
94 struct mt7921_asar_dyn *dyn;
95 struct mt7921_asar_dyn_v2 *dyn_v2;
96 };
97 union {
98 struct mt7921_asar_geo *geo;
99 struct mt7921_asar_geo_v2 *geo_v2;
100 };
101 struct mt7921_asar_cl *countrylist;
102 struct mt7921_asar_fg *fg;
103 };
The DECLARE_FLEX_ARRAY() helper was created to declare flex-array members
in unions or alone in structs[1].
--
Gustavo
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Powered by blists - more mailing lists