[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <170678189299.2736043.11616312910656558919.kvalo@kernel.org>
Date: Thu, 1 Feb 2024 10:04:55 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Arend van Spriel <aspriel@...il.com>, Kees Cook <keescook@...omium.org>,
Franky Lin <franky.lin@...adcom.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Chi-hsien Lin <chi-hsien.lin@...ineon.com>, Ian Lin <ian.lin@...ineon.com>,
Johannes Berg <johannes.berg@...el.com>,
Wright Feng <wright.feng@...ress.com>, Hector Martin <marcan@...can.st>,
linux-wireless@...r.kernel.org, brcm80211-dev-list.pdl@...adcom.com,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Jisoo Jang <jisoo.jang@...sei.ac.kr>, Hans de Goede <hdegoede@...hat.com>,
Aloka Dixit <quic_alokad@...cinc.com>, John Keeping <john@...ping.me.uk>,
Jeff Johnson <quic_jjohnson@...cinc.com>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] wifi: brcmfmac: Adjust n_channels usage for __counted_by
Kees Cook <keescook@...omium.org> wrote:
> After commit e3eac9f32ec0 ("wifi: cfg80211: Annotate struct
> cfg80211_scan_request with __counted_by"), the compiler may enforce
> dynamic array indexing of req->channels to stay below n_channels. As a
> result, n_channels needs to be increased _before_ accessing the newly
> added array index. Increment it first, then use "i" for the prior index.
> Solves this warning in the coming GCC that has __counted_by support:
>
> ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function 'brcmf_internal_escan_add_info':
> ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3783:46: warning: operation on 'req->
> n_channels' may be undefined [-Wsequence-point]
> 3783 | req->channels[req->n_channels++] = chan;
> | ~~~~~~~~~~~~~~~^~
>
> Fixes: e3eac9f32ec0 ("wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by")
> Cc: Arend van Spriel <aspriel@...il.com>
> Cc: Franky Lin <franky.lin@...adcom.com>
> Cc: Hante Meuleman <hante.meuleman@...adcom.com>
> Cc: Kalle Valo <kvalo@...nel.org>
> Cc: Chi-hsien Lin <chi-hsien.lin@...ineon.com>
> Cc: Ian Lin <ian.lin@...ineon.com>
> Cc: Johannes Berg <johannes.berg@...el.com>
> Cc: Wright Feng <wright.feng@...ress.com>
> Cc: Hector Martin <marcan@...can.st>
> Cc: linux-wireless@...r.kernel.org
> Cc: brcm80211-dev-list.pdl@...adcom.com
> Signed-off-by: Kees Cook <keescook@...omium.org>
> Reviewed-by: Hans de Goede <hdegoede@...hat.com>
> Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
> Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
I'm planning to queue this for wireless tree. Arend, ack?
--
https://patchwork.kernel.org/project/linux-wireless/patch/20240126223150.work.548-kees@kernel.org/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists