diff mbox series

[1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR

Message ID 20240919081216.28505-2-pkshih@realtek.com (mailing list archive)
State Accepted
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtw89: fix some coverity warnings | expand

Commit Message

Ping-Ke Shih Sept. 19, 2024, 8:12 a.m. UTC
The return value of ieee80211_probereq_get() might be NULL, so check it
before using to avoid NULL pointer access.

Addresses-Coverity-ID: 1529805 ("Dereference null return value")

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/fw.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ping-Ke Shih Sept. 26, 2024, 1:24 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> The return value of ieee80211_probereq_get() might be NULL, so check it
> before using to avoid NULL pointer access.
> 
> Addresses-Coverity-ID: 1529805 ("Dereference null return value")
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

3 patch(es) applied to rtw-next branch of rtw.git, thanks.

630d5d8f2bf6 wifi: rtw89: check return value of ieee80211_probereq_get() for RNR
6cdfb5659624 wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl()
7bf2f8fe4237 wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value of _dpk_dgain_read()

---
https://github.com/pkshih/rtw.git
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 37f931e88791..02831514376f 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -6074,6 +6074,9 @@  static int rtw89_update_6ghz_rnr_chan(struct rtw89_dev *rtwdev,
 
 		skb = ieee80211_probereq_get(rtwdev->hw, rtwvif_link->mac_addr,
 					     NULL, 0, req->ie_len);
+		if (!skb)
+			return -ENOMEM;
+
 		skb_put_data(skb, ies->ies[NL80211_BAND_6GHZ], ies->len[NL80211_BAND_6GHZ]);
 		skb_put_data(skb, ies->common_ies, ies->common_ie_len);
 		hdr = (struct ieee80211_hdr *)skb->data;