Commit 73f57f83 authored by Roel Kluin's avatar Roel Kluin Committed by John W. Linville

ath9k: Fix read buffer overflow

Prevent a read of powInfo[-1] in the first iteration.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5bf6fcc2
...@@ -143,10 +143,10 @@ void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, ...@@ -143,10 +143,10 @@ void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah,
IS_CHAN_2GHZ(chan))) { IS_CHAN_2GHZ(chan))) {
matchIndex = i; matchIndex = i;
break; break;
} else if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, } else if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
IS_CHAN_2GHZ(chan))) && IS_CHAN_2GHZ(chan)) && i > 0 &&
(freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
IS_CHAN_2GHZ(chan)))) { IS_CHAN_2GHZ(chan))) {
lowIndex = i - 1; lowIndex = i - 1;
break; break;
} }
...@@ -198,10 +198,10 @@ void ath9k_hw_get_target_powers(struct ath_hw *ah, ...@@ -198,10 +198,10 @@ void ath9k_hw_get_target_powers(struct ath_hw *ah,
matchIndex = i; matchIndex = i;
break; break;
} else } else
if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
IS_CHAN_2GHZ(chan))) && IS_CHAN_2GHZ(chan)) && i > 0 &&
(freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
IS_CHAN_2GHZ(chan)))) { IS_CHAN_2GHZ(chan))) {
lowIndex = i - 1; lowIndex = i - 1;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment