Commit beae416b authored by Michal Nazarewicz's avatar Michal Nazarewicz Committed by John W. Linville

net: wireless: ath9k: avoid possible NULL pointer dereference

Code in ath9k_hw_set_clockrate function indicates that ah->curchan
(and thus chan local variable) may be NULL.  If that is indeed the
case, IS_CHAN_HT40(chan) check has to be performed only in branch
where chan is not NULL.  Moving the code under already existing
if condition fixes this issue.
Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a1783a7b
...@@ -146,10 +146,9 @@ static void ath9k_hw_set_clockrate(struct ath_hw *ah) ...@@ -146,10 +146,9 @@ static void ath9k_hw_set_clockrate(struct ath_hw *ah)
else else
clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
if (chan) {
if (IS_CHAN_HT40(chan)) if (IS_CHAN_HT40(chan))
clockrate *= 2; clockrate *= 2;
if (ah->curchan) {
if (IS_CHAN_HALF_RATE(chan)) if (IS_CHAN_HALF_RATE(chan))
clockrate /= 2; clockrate /= 2;
if (IS_CHAN_QUARTER_RATE(chan)) if (IS_CHAN_QUARTER_RATE(chan))
......
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