netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Simon Horman <simon.horman@corigine.com>
Cc: Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>, Kalle Valo <kvalo@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members
Date: Mon, 20 Mar 2023 13:26:49 -0600	[thread overview]
Message-ID: <ZBizeZ5DaBT5KKXN@work> (raw)
In-Reply-To: <ZBh0NhaNFnttWRz8@corigine.com>

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


  reply	other threads:[~2023-03-20 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 20:56 [PATCH][next] wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members Gustavo A. R. Silva
2023-03-20 14:56 ` Simon Horman
2023-03-20 19:26   ` Gustavo A. R. Silva [this message]
2023-03-20 19:48     ` Simon Horman
2023-03-30 20:11 ` Gustavo A. R. Silva

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=ZBizeZ5DaBT5KKXN@work \
    --to=gustavoars@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=simon.horman@corigine.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).