From: Jerome Pouiller <Jerome.Pouiller@silabs.com> To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: 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>, "Jérôme Pouiller" <jerome.pouiller@silabs.com>, "kernel test robot" <lkp@intel.com>, "Nathan Chancellor" <natechancellor@gmail.com> Subject: [PATCH 1/2] staging: wfx: fix use of uninitialized pointer Date: Mon, 19 Oct 2020 18:06:03 +0200 [thread overview] Message-ID: <20201019160604.1609180-1-Jerome.Pouiller@silabs.com> (raw) 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> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Jerome Pouiller <Jerome.Pouiller@silabs.com> To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Nathan Chancellor <natechancellor@gmail.com>, "David S . Miller" <davem@davemloft.net>, Kalle Valo <kvalo@codeaurora.org> Subject: [PATCH 1/2] staging: wfx: fix use of uninitialized pointer Date: Mon, 19 Oct 2020 18:06:03 +0200 [thread overview] Message-ID: <20201019160604.1609180-1-Jerome.Pouiller@silabs.com> (raw) 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> --- 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 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next reply other threads:[~2020-10-19 16:06 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-19 16:06 Jerome Pouiller [this message] 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-19 16:06 ` Jerome Pouiller 2020-10-20 1:07 ` [PATCH 1/2] staging: wfx: fix use of uninitialized pointer Nathan Chancellor 2020-10-20 1:07 ` Nathan Chancellor
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=20201019160604.1609180-1-Jerome.Pouiller@silabs.com \ --to=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=natechancellor@gmail.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: linkBe 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.