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
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
WARNING: multiple messages have this Message-ID (diff)
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
next prev parent reply other threads:[~2021-08-26 5:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 5:04 [PATCH v2 0/5] Enable -Warray-bounds and -Wzero-length-bounds Kees Cook
2021-08-26 5:04 ` [PATCH v2 1/5] stddef: Add flexible array union helper Kees Cook
2021-08-26 5:04 ` [PATCH v2 2/5] treewide: Replace open-coded flex arrays in unions Kees Cook
2021-08-26 5:04 ` Kees Cook
2021-08-26 6:24 ` Marc Kleine-Budde
2021-08-26 6:24 ` Marc Kleine-Budde
2021-08-27 16:08 ` Kees Cook
2021-08-27 16:08 ` Kees Cook
2021-08-27 17:08 ` Marc Kleine-Budde
2021-08-27 17:08 ` Marc Kleine-Budde
2021-08-27 16:17 ` Kees Cook
2021-08-27 16:17 ` Kees Cook
2021-08-28 7:31 ` Vincent MAILHOL
2021-08-28 7:31 ` Vincent MAILHOL
2021-08-26 7:36 ` Vincent MAILHOL
2021-08-26 7:36 ` Vincent MAILHOL
2021-08-26 15:39 ` Kees Cook
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:04 ` Kees Cook
2021-08-26 5:24 ` Keith Packard
2021-08-26 5:24 ` Keith Packard
2021-08-26 5:51 ` Kees Cook [this message]
2021-08-26 5:51 ` Kees Cook
2021-08-26 5:04 ` [PATCH v2 4/5] Makefile: Enable -Warray-bounds Kees Cook
2021-08-26 5:04 ` [PATCH v2 5/5] Makefile: Enable -Wzero-length-bounds Kees Cook
2021-08-27 9:25 ` [PATCH v2 1/5] stddef: Add flexible array union helper Vincent Mailhol
2021-08-27 15:39 ` Kees Cook
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.org \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=Larry.Finger@lwfinger.net \
--cc=arnd@arndb.de \
--cc=ath10k@lists.infradead.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=clang-built-linux@googlegroups.com \
--cc=dan.j.williams@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=davem@davemloft.net \
--cc=fabioaiuto83@gmail.com \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavoars@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=johannes@sipsolutions.net \
--cc=keithp@keithp.com \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=marcocesati@gmail.com \
--cc=martin.petersen@oracle.com \
--cc=mrangankar@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=njavali@marvell.com \
--cc=phil@philpotter.co.uk \
--cc=ross.schm.dev@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.