Skip to contentSkip to conversation

mwifiex: fix uninitialized variable access in pcie_remove

PATCH In review Arnd Bergmann 2 participants 2 messages Jan 13, 2017 – Jan 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mwifiex: fix uninitialized variable access in pcie_remove

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")
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/pcie.c +2 -0
index 031141663fc0..eebc68caecdd 100644
@@ -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);
Signature · 1 line
2.9.0
#1 lore raw
Quoted 11 lines · Arnd Bergmann

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

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

0e8edb9aed03 mwifiex: fix uninitialized variable access in pcie_remove

Signature · 6 lines
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