[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1652671437-20235-1-git-send-email-baihaowen@meizu.com>
Date: Mon, 16 May 2022 11:23:56 +0800
From: Haowen Bai <baihaowen@...zu.com>
To: Kalle Valo <kvalo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
"Paolo Abeni" <pabeni@...hat.com>
CC: Haowen Bai <baihaowen@...zu.com>, <ath11k@...ts.infradead.org>,
<linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] ath11k: Fix pointer dereferenced before checking
The pointer sspec is dereferencing pointer sar before sar is being
null checked. Fix this by assigning sar->sub_specs to sspec only if
sar is not NULL, otherwise just NULL. The code has checked sar whether
it is NULL or not as below, but use before checking.
Signed-off-by: Haowen Bai <baihaowen@...zu.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1957e1713548..fe97c9a3c1c5 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8287,7 +8287,7 @@ static int ath11k_mac_op_set_bios_sar_specs(struct ieee80211_hw *hw,
const struct cfg80211_sar_specs *sar)
{
struct ath11k *ar = hw->priv;
- const struct cfg80211_sar_sub_specs *sspec = sar->sub_specs;
+ const struct cfg80211_sar_sub_specs *sspec = sar ? sar->sub_specs : NULL;
int ret, index;
u8 *sar_tbl;
u32 i;
--
2.7.4
Powered by blists - more mailing lists