From: Kees Cook <keescook@chromium.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Krzysztof Halasa <khalasa@piap.pl>, Arnd Bergmann <arnd@arndb.de>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] ARM: ixp4xx: Replace 0-length arrays with flexible arrays
Date: Thu, 12 Jan 2023 14:54:00 -0800 [thread overview]
Message-ID: <202301121452.14D1A95CA@keescook> (raw)
In-Reply-To: <CACRpkdYfsY7K8GksccDunCfKHbq_Df8ddrYGRg2gmeu6CVCF5w@mail.gmail.com>
On Sun, Jan 08, 2023 at 12:58:37AM +0100, Linus Walleij wrote:
> On Thu, Jan 5, 2023 at 10:57 PM Kees Cook <keescook@chromium.org> wrote:
>
> > Zero-length arrays are deprecated[1]. Replace npe_load_firmware's
> > union of 0-length arrays with flexible arrays. Detected with GCC 13,
> > using -fstrict-flex-arrays=3:
> >
> > drivers/soc/ixp4xx/ixp4xx-npe.c: In function 'npe_load_firmware':
> > drivers/soc/ixp4xx/ixp4xx-npe.c:570:60: warning: array subscript i is outside array bounds of 'u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=]
> > 570 | image->data[i] = swab32(image->data[i]);
> > include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32'
> > 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
> > | ^
> > drivers/soc/ixp4xx/ixp4xx-npe.c:570:42: note: in expansion of macro 'swab32'
> > 570 | image->data[i] = swab32(image->data[i]);
> > | ^~~~~~
> > drivers/soc/ixp4xx/ixp4xx-npe.c:522:29: note: while referencing 'data'
> > 522 | u32 data[0];
> > | ^~~~
> >
> > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
> >
> > Cc: Krzysztof Halasa <khalasa@piap.pl>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
> > Cc: linux-arm-kernel@lists.infradead.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
>
> Looks good to me:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Thanks!
> Do you need me to funnel this to the SoC tree or do you have
> some quickpath for fixes like this?
I'll take it via my tree if unless you'd rather it go through yours.
Most maintainers take these directly, but some don't want to. I'm
flexible! :)
--
Kees Cook
next prev parent reply other threads:[~2023-01-12 22:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 21:57 [PATCH] ARM: ixp4xx: Replace 0-length arrays with flexible arrays Kees Cook
2023-01-07 23:58 ` Linus Walleij
2023-01-12 22:54 ` Kees Cook [this message]
2023-01-16 10:31 ` Linus Walleij
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=202301121452.14D1A95CA@keescook \
--to=keescook@chromium.org \
--cc=arnd@arndb.de \
--cc=gustavoars@kernel.org \
--cc=khalasa@piap.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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