* [PATCH] staging: wfx: avoid uninitialized variable use
@ 2020-10-26 16:02 Arnd Bergmann
2020-10-26 16:11 ` Jérôme Pouiller
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2020-10-26 16:02 UTC (permalink / raw)
To: Jérôme Pouiller, Greg Kroah-Hartman, Nathan Chancellor,
Nick Desaulniers
Cc: devel, clang-built-linux, Dan Carpenter, Arnd Bergmann, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Move the added check of the 'band' variable after the
initialization. Pointed out by clang with
drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized]
if (rate->idx >= band->n_bitrates) {
Fixes: 868fd970e187 ("staging: wfx: improve robustness of wfx_get_hw_rate()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/staging/wfx/data_tx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 41f6a604a697..36b36ef39d05 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -31,13 +31,13 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev,
}
return rate->idx + 14;
}
+ // WFx only support 2GHz, else band information should be retrieved
+ // from ieee80211_tx_info
+ band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
if (rate->idx >= band->n_bitrates) {
WARN(1, "wrong rate->idx value: %d", rate->idx);
return -1;
}
- // WFx only support 2GHz, else band information should be retrieved
- // from ieee80211_tx_info
- band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
return band->bitrates[rate->idx].hw_value;
}
--
2.27.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: wfx: avoid uninitialized variable use
2020-10-26 16:02 [PATCH] staging: wfx: avoid uninitialized variable use Arnd Bergmann
@ 2020-10-26 16:11 ` Jérôme Pouiller
2020-10-27 12:24 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Jérôme Pouiller @ 2020-10-26 16:11 UTC (permalink / raw)
To: Greg Kroah-Hartman, Nathan Chancellor, Nick Desaulniers, Arnd Bergmann
Cc: devel, clang-built-linux, Dan Carpenter, Arnd Bergmann, linux-kernel
On Monday 26 October 2020 17:02:22 CET Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Move the added check of the 'band' variable after the
> initialization. Pointed out by clang with
>
> drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized]
> if (rate->idx >= band->n_bitrates) {
Hello Arnd,
This patch has already been submitted[1]. I think it is going to be
applied to staging very soon.
Sorry for the disturbing.
[1] https://lore.kernel.org/driverdev-devel/20201019160604.1609180-1-Jerome.Pouiller@silabs.com/
--
Jérôme Pouiller
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: wfx: avoid uninitialized variable use
2020-10-26 16:11 ` Jérôme Pouiller
@ 2020-10-27 12:24 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-10-27 12:24 UTC (permalink / raw)
To: Jérôme Pouiller
Cc: devel, Arnd Bergmann, Arnd Bergmann, Nick Desaulniers,
linux-kernel, clang-built-linux, Nathan Chancellor,
Dan Carpenter
On Mon, Oct 26, 2020 at 05:11:11PM +0100, Jérôme Pouiller wrote:
> On Monday 26 October 2020 17:02:22 CET Arnd Bergmann wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > Move the added check of the 'band' variable after the
> > initialization. Pointed out by clang with
> >
> > drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized]
> > if (rate->idx >= band->n_bitrates) {
>
> Hello Arnd,
>
> This patch has already been submitted[1]. I think it is going to be
> applied to staging very soon.
>
> Sorry for the disturbing.
>
> [1] https://lore.kernel.org/driverdev-devel/20201019160604.1609180-1-Jerome.Pouiller@silabs.com/
Sorry for the delay, had to wait until -rc1 was out.
Now queued up in my tree.
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-27 12:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 16:02 [PATCH] staging: wfx: avoid uninitialized variable use Arnd Bergmann
2020-10-26 16:11 ` Jérôme Pouiller
2020-10-27 12:24 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).