netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: fix uninitialized variable access in pcie_remove
@ 2017-01-13 15:35 Arnd Bergmann
  2017-01-17 11:55 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-01-13 15:35 UTC (permalink / raw)
  To: Amitkumar Karwar, Kalle Valo
  Cc: Arnd Bergmann, Nishant Sarmukadam, Brian Norris, Xinming Hu,
	Cathy Luo, Shengzhen Li, linux-wireless, netdev, linux-kernel

Checking the firmware status from PCIe register only works
if the register is available, otherwise we end up with
random behavior:

drivers/net/wireless/marvell/mwifiex/pcie.c: In function 'mwifiex_pcie_remove':
drivers/net/wireless/marvell/mwifiex/pcie.c:585:5: error: 'fw_status' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This makes sure we treat the absence of the register as a failure.

Fixes: 045f0c1b5e26 ("mwifiex: get rid of global user_rmmod flag")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 031141663fc0..eebc68caecdd 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -581,6 +581,8 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
 	reg = card->pcie.reg;
 	if (reg)
 		ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
+	else
+		fw_status = -1;
 
 	if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
 		mwifiex_deauthenticate_all(adapter);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: mwifiex: fix uninitialized variable access in pcie_remove
  2017-01-13 15:35 [PATCH] mwifiex: fix uninitialized variable access in pcie_remove Arnd Bergmann
@ 2017-01-17 11:55 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2017-01-17 11:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Amitkumar Karwar, Arnd Bergmann, Nishant Sarmukadam, Brian Norris,
	Xinming Hu, Cathy Luo, Shengzhen Li, linux-wireless, netdev,
	linux-kernel

Arnd Bergmann <arnd@arndb.de> wrote:
> Checking the firmware status from PCIe register only works
> if the register is available, otherwise we end up with
> random behavior:
> 
> drivers/net/wireless/marvell/mwifiex/pcie.c: In function 'mwifiex_pcie_remove':
> drivers/net/wireless/marvell/mwifiex/pcie.c:585:5: error: 'fw_status' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This makes sure we treat the absence of the register as a failure.
> 
> Fixes: 045f0c1b5e26 ("mwifiex: get rid of global user_rmmod flag")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied to wireless-drivers-next.git, thanks.

0e8edb9aed03 mwifiex: fix uninitialized variable access in pcie_remove

-- 
https://patchwork.kernel.org/patch/9515899/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-17 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13 15:35 [PATCH] mwifiex: fix uninitialized variable access in pcie_remove Arnd Bergmann
2017-01-17 11:55 ` Kalle Valo

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).