Skip to contentSkip to conversation

ath9k_hw: fix uninitialized variable data

PATCH In review Denis Efremov 2 participants 2 messages Sep 26, 2019 – Oct 1, 2019

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

PATCH 1/1 ath9k_hw: fix uninitialized variable data

Currently, data variable in ar9003_hw_thermo_cal_apply() could be uninitialized if ar9300_otp_read_word() will fail to read the value. Initialize data variable with 0 to prevent an undefined behavior. This will be enough to handle error case when ar9300_otp_read_word() fails.

Fixes 80fe43f2bbd5 ("ath9k_hw: Read and configure thermocal for AR9462")
Cc Rajkumar Manoharan <[email protected]>
Cc John W. Linville <[email protected]>
Cc Kalle Valo <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
index 2b29bf4730f6..b4885a700296 100644
@@ -4183,7 +4183,7 @@ static void ar9003_hw_thermometer_apply(struct ath_hw *ah)
 
 static void ar9003_hw_thermo_cal_apply(struct ath_hw *ah)
 {
-	u32 data, ko, kg;
+	u32 data = 0, ko, kg;
 
 	if (!AR_SREV_9462_20_OR_LATER(ah))
 		return;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 5 lines · Denis Efremov

Currently, data variable in ar9003_hw_thermo_cal_apply() could be uninitialized if ar9300_otp_read_word() will fail to read the value. Initialize data variable with 0 to prevent an undefined behavior. This will be enough to handle error case when ar9300_otp_read_word() fails.

Quoted 8 lines
Fixes 80fe43f2bbd5 ("ath9k_hw: Read and configure thermocal for AR9462")
Cc Rajkumar Manoharan <[email protected]>
Cc John W. Linville <[email protected]>
Cc Kalle Valo <[email protected]>
Cc "David S. Miller" <[email protected]>

Patch applied to ath-next branch of ath.git, thanks.

80e84f36412e ath9k_hw: fix uninitialized variable data

Signature · 3 lines
https://patchwork.kernel.org/patch/11163437/

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