From: Nathan Chancellor <natechancellor@gmail.com>
To: Jerome Pouiller <Jerome.Pouiller@silabs.com>
Cc: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kalle Valo <kvalo@codeaurora.org>,
"David S . Miller" <davem@davemloft.net>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/2] staging: wfx: fix use of uninitialized pointer
Date: Mon, 19 Oct 2020 18:07:54 -0700 [thread overview]
Message-ID: <20201020010754.GB1817488@ubuntu-m3-large-x86> (raw)
In-Reply-To: <20201019160604.1609180-1-Jerome.Pouiller@silabs.com>
On Mon, Oct 19, 2020 at 06:06:03PM +0200, Jerome Pouiller wrote:
> From: Jérôme Pouiller <jerome.pouiller@silabs.com>
>
> With -Wuninitialized, the compiler complains:
>
> drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized]
> if (rate->idx >= band->n_bitrates) {
> ^~~~
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Fixes: 868fd970e187 ("staging: wfx: improve robustness of wfx_get_hw_rate()")
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/staging/wfx/data_tx.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 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;
> }
> - 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];
> + if (rate->idx >= band->n_bitrates) {
> + WARN(1, "wrong rate->idx value: %d", rate->idx);
> + return -1;
> + }
> return band->bitrates[rate->idx].hw_value;
> }
>
> --
> 2.28.0
>
prev parent reply other threads:[~2020-10-20 1:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 16:06 [PATCH 1/2] staging: wfx: fix use of uninitialized pointer Jerome Pouiller
2020-10-19 16:06 ` [PATCH 2/2] staging: wfx: fix test on return value of gpiod_get_value() Jerome Pouiller
2020-10-20 1:07 ` Nathan Chancellor [this message]
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=20201020010754.GB1817488@ubuntu-m3-large-x86 \
--to=natechancellor@gmail.com \
--cc=Jerome.Pouiller@silabs.com \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lkp@intel.com \
--cc=netdev@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