From: Kees Cook <keescook@chromium.org>
To: Kalle Valo <kvalo@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
johannes@sipsolutions.net, netdev@vger.kernel.org,
linux-wireless@vger.kernel.org, toke@toke.dk,
linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH net-next 2/8] wifi: ath9k: silence array-bounds warning on GCC 12
Date: Mon, 23 May 2022 12:31:23 -0700 [thread overview]
Message-ID: <202205231229.CF6B8471@keescook> (raw)
In-Reply-To: <87h75j1iej.fsf@kernel.org>
On Sat, May 21, 2022 at 09:58:28AM +0300, Kalle Valo wrote:
> + arnd, kees, lkml
>
> Jakub Kicinski <kuba@kernel.org> writes:
>
> > GCC 12 says:
> >
> > drivers/net/wireless/ath/ath9k/mac.c: In function ‘ath9k_hw_resettxqueue’:
> > drivers/net/wireless/ath/ath9k/mac.c:373:22: warning: array subscript
> > 32 is above array bounds of ‘struct ath9k_tx_queue_info[10]’
> > [-Warray-bounds]
> > 373 | qi = &ah->txq[q];
> > | ~~~~~~~^~~
> >
> > I don't know where it got the 32 from, relegate the warning to W=1+.
> >
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> > ---
> > CC: toke@toke.dk
> > CC: kvalo@kernel.org
> > CC: linux-wireless@vger.kernel.org
> > ---
> > drivers/net/wireless/ath/ath9k/Makefile | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile
> > index eff94bcd1f0a..9bdfcee2f448 100644
> > --- a/drivers/net/wireless/ath/ath9k/Makefile
> > +++ b/drivers/net/wireless/ath/ath9k/Makefile
> > @@ -45,6 +45,11 @@ ath9k_hw-y:= \
> > ar9003_eeprom.o \
> > ar9003_paprd.o
> >
> > +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds
> > +ifndef KBUILD_EXTRA_WARN
> > +CFLAGS_mac.o += -Wno-array-bounds
> > +endif
>
> There are now four wireless drivers which need this hack. Wouldn't it be
> easier to add -Wno-array-bounds for GCC 12 globally instead of adding
> the same hack to multiple drivers?
I finally tracked this down to a GCC 12 bug related to -fsanitize=shift:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679
Basically all the "32" stuff comes from the index being used in a shift,
and the resulting internal GCC logic blowing up.
I was going to do a before/after build with and without -fsanitize=shift
to see how many of these false positives originate from that bug...
--
Kees Cook
next prev parent reply other threads:[~2022-05-23 19:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 19:43 [PATCH net-next 0/8] Fix/silence GCC 12 warnings in drivers/net/wireless/ Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 1/8] wifi: plfxlc: remove redundant NULL-check for GCC 12 Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 2/8] wifi: ath9k: silence array-bounds warning on " Jakub Kicinski
2022-05-21 6:58 ` Kalle Valo
2022-05-21 17:53 ` Jakub Kicinski
2022-05-22 12:06 ` Kalle Valo
2022-05-23 19:31 ` Kees Cook [this message]
2022-05-20 19:43 ` [PATCH net-next 3/8] wifi: rtlwifi: remove always-true condition pointed out by " Jakub Kicinski
2022-05-23 2:35 ` Ping-Ke Shih
2022-05-23 15:57 ` Jakub Kicinski
2022-05-24 0:41 ` Ping-Ke Shih
2022-05-20 19:43 ` [PATCH net-next 4/8] wifi: ath6k: silence false positive -Wno-dangling-pointer warning on " Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 5/8] wifi: iwlwifi: use unsigned to silence a GCC 12 warning Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 6/8] wifi: brcmfmac: work around a GCC 12 -Warray-bounds warning Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 7/8] wifi: libertas: silence " Jakub Kicinski
2022-05-21 22:03 ` Johannes Berg
2022-05-22 16:56 ` Jakub Kicinski
2022-05-20 19:43 ` [PATCH net-next 8/8] wifi: carl9170: " Jakub Kicinski
2022-05-20 19:58 ` Christian Lamparter
2022-05-22 12:19 ` [PATCH net-next 0/8] Fix/silence GCC 12 warnings in drivers/net/wireless/ Kalle Valo
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=202205231229.CF6B8471@keescook \
--to=keescook@chromium.org \
--cc=arnd@arndb.de \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=toke@toke.dk \
/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.