public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium•org>
To: Keith Packard <keithp@keithp•com>
Cc: linux-kernel@vger•kernel.org,
	"Gustavo A. R. Silva" <gustavoars@kernel•org>,
	Arnd Bergmann <arnd@arndb•de>, Kalle Valo <kvalo@codeaurora•org>,
	"David S. Miller" <davem@davemloft•net>,
	Jakub Kicinski <kuba@kernel•org>,
	Nilesh Javali <njavali@marvell•com>,
	Manish Rangankar <mrangankar@marvell•com>,
	GR-QLogic-Storage-Upstream@marvell•com,
	"James E.J. Bottomley" <jejb@linux•ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle•com>,
	Larry Finger <Larry.Finger@lwfinger•net>,
	Phillip Potter <phil@philpotter•co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	Florian Schilhabel <florian.c.schilhabel@googlemail•com>,
	Johannes Berg <johannes@sipsolutions•net>,
	Christophe JAILLET <christophe.jaillet@wanadoo•fr>,
	Fabio Aiuto <fabioaiuto83@gmail•com>,
	Ross Schmidt <ross.schm.dev@gmail•com>,
	Marco Cesati <marcocesati@gmail•com>,
	ath10k@lists•infradead.org, linux-wireless@vger•kernel.org,
	netdev@vger•kernel.org, linux-scsi@vger•kernel.org,
	linux-staging@lists•linux.dev,
	Rasmus Villemoes <linux@rasmusvillemoes•dk>,
	Dan Williams <dan.j.williams@intel•com>,
	Daniel Vetter <daniel.vetter@ffwll•ch>,
	clang-built-linux@googlegroups•com,
	linux-hardening@vger•kernel.org
Subject: Re: [PATCH v2 3/5] treewide: Replace 0-element memcpy() destinations with flexible arrays
Date: Wed, 25 Aug 2021 22:51:20 -0700	[thread overview]
Message-ID: <202108252250.C1DAEE5@keescook> (raw)
In-Reply-To: <87r1egpym5.fsf@keithp.com>

On Wed, Aug 25, 2021 at 10:24:18PM -0700, Keith Packard wrote:
> Kees Cook <keescook@chromium•org> writes:
> 
> > In some cases, use of the flex_array() helper is needed when a flexible
> > array is part of a union.
> 
> The code below seems to show that the helper is also needed when the
> flexible array is the only member of a struct? Or is this just an
> extension of the 'part of a union' clause?

That's correct. I have that documented in the DECLARE_FLEX_ARRAY macro
itself, but I mis-spoke in this changelog here (the uses were for "alone
in a struct"). I've adjusted the changelog now. :)

Thanks!

-Kees

> 
> > @@ -160,7 +160,7 @@ struct bmi_cmd {
> >  
> >  union bmi_resp {
> >  	struct {
> > -		u8 payload[0];
> > +		DECLARE_FLEX_ARRAY(u8, payload);
> >  	} read_mem;
> >  	struct {
> >  		__le32 result;
> 
> -- 
> -keith



-- 
Kees Cook

      reply	other threads:[~2021-08-26  5:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210826050458.1540622-1-keescook@chromium.org>
2021-08-26  5:04 ` [PATCH v2 2/5] treewide: Replace open-coded flex arrays in unions Kees Cook
2021-08-26  6:24   ` Marc Kleine-Budde
2021-08-27 16:08     ` Kees Cook
2021-08-27 17:08       ` Marc Kleine-Budde
2021-08-27 16:17     ` Kees Cook
2021-08-28  7:31       ` Vincent MAILHOL
2021-08-26  7:36   ` Vincent MAILHOL
2021-08-26 15:39     ` Kees Cook
2021-08-26  5:04 ` [PATCH v2 3/5] treewide: Replace 0-element memcpy() destinations with flexible arrays Kees Cook
2021-08-26  5:24   ` Keith Packard
2021-08-26  5:51     ` Kees Cook [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=202108252250.C1DAEE5@keescook \
    --to=keescook@chromium$(echo .)org \
    --cc=GR-QLogic-Storage-Upstream@marvell$(echo .)com \
    --cc=Larry.Finger@lwfinger$(echo .)net \
    --cc=arnd@arndb$(echo .)de \
    --cc=ath10k@lists$(echo .)infradead.org \
    --cc=christophe.jaillet@wanadoo$(echo .)fr \
    --cc=clang-built-linux@googlegroups$(echo .)com \
    --cc=dan.j.williams@intel$(echo .)com \
    --cc=daniel.vetter@ffwll$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=fabioaiuto83@gmail$(echo .)com \
    --cc=florian.c.schilhabel@googlemail$(echo .)com \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=gustavoars@kernel$(echo .)org \
    --cc=jejb@linux$(echo .)ibm.com \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=keithp@keithp$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=kvalo@codeaurora$(echo .)org \
    --cc=linux-hardening@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-scsi@vger$(echo .)kernel.org \
    --cc=linux-staging@lists$(echo .)linux.dev \
    --cc=linux-wireless@vger$(echo .)kernel.org \
    --cc=linux@rasmusvillemoes$(echo .)dk \
    --cc=marcocesati@gmail$(echo .)com \
    --cc=martin.petersen@oracle$(echo .)com \
    --cc=mrangankar@marvell$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=njavali@marvell$(echo .)com \
    --cc=phil@philpotter$(echo .)co.uk \
    --cc=ross.schm.dev@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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