]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: fix NULL pointer access in ath12k_mac_op_get_survey()
authorAaradhana Sahu <quic_aarasahu@quicinc.com>
Tue, 11 Jun 2024 03:10:16 +0000 (08:40 +0530)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 19 Jun 2024 14:00:51 +0000 (17:00 +0300)
Smatch throws below error

drivers/net/wireless/ath/ath12k/mac.c:8318 ath12k_mac_op_get_survey() error: we previously assumed 'sband' could be null

Currently, we access sband inside the null check of the sband
in ath12k_mac_op_get_survey().

Fix this issue by removing the entire if block, because decrement
idx is unnecessary since there are no more band to test.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Fixes: 70e3be54bbdd ("wifi: ath12k: fix survey dump collection in 6 GHz")
Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240611031017.297927-2-quic_aarasahu@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index bc2da8530651da85d58f6cbc6cdd7a9c69d32cd2..00a158c2297136656c22e504252d55a8d2a7a92f 100644 (file)
@@ -8291,10 +8291,6 @@ static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx,
 
        if (!sband)
                sband = hw->wiphy->bands[NL80211_BAND_6GHZ];
-       if (!sband || idx >= sband->n_channels) {
-               idx -= sband->n_channels;
-               sband = NULL;
-       }
 
        if (!sband || idx >= sband->n_channels)
                return -ENOENT;