[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202108252250.C1DAEE5@keescook>
Date: Wed, 25 Aug 2021 22:51:20 -0700
From: Kees Cook <keescook@...omium.org>
To: Keith Packard <keithp@...thp.com>
Cc: linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Nilesh Javali <njavali@...vell.com>,
Manish Rangankar <mrangankar@...vell.com>,
GR-QLogic-Storage-Upstream@...vell.com,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
Johannes Berg <johannes@...solutions.net>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Fabio Aiuto <fabioaiuto83@...il.com>,
Ross Schmidt <ross.schm.dev@...il.com>,
Marco Cesati <marcocesati@...il.com>,
ath10k@...ts.infradead.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-staging@...ts.linux.dev,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Dan Williams <dan.j.williams@...el.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
clang-built-linux@...glegroups.com, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2 3/5] treewide: Replace 0-element memcpy() destinations
with flexible arrays
On Wed, Aug 25, 2021 at 10:24:18PM -0700, Keith Packard wrote:
> Kees Cook <keescook@...omium.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
Powered by blists - more mailing lists