linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] wifi: rtw89: fix some coverity warnings
@ 2024-09-19  8:12 Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR Ping-Ke Shih
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2024-09-19  8:12 UTC (permalink / raw)
  To: linux-wireless

These warnings are minor because they could happen rarely or harmless,
but worth to fix them.

Ping-Ke Shih (3):
  wifi: rtw89: check return value of ieee80211_probereq_get() for RNR
  wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl()
  wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value
    of _dpk_dgain_read()

 drivers/net/wireless/realtek/rtw89/coex.c         | 2 ++
 drivers/net/wireless/realtek/rtw89/fw.c           | 3 +++
 drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR
  2024-09-19  8:12 [PATCH 0/3] wifi: rtw89: fix some coverity warnings Ping-Ke Shih
@ 2024-09-19  8:12 ` Ping-Ke Shih
  2024-09-26  1:24   ` Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 2/3] wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl() Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 3/3] wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value of _dpk_dgain_read() Ping-Ke Shih
  2 siblings, 1 reply; 5+ messages in thread
From: Ping-Ke Shih @ 2024-09-19  8:12 UTC (permalink / raw)
  To: linux-wireless

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(+)

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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl()
  2024-09-19  8:12 [PATCH 0/3] wifi: rtw89: fix some coverity warnings Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR Ping-Ke Shih
@ 2024-09-19  8:12 ` Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 3/3] wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value of _dpk_dgain_read() Ping-Ke Shih
  2 siblings, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2024-09-19  8:12 UTC (permalink / raw)
  To: linux-wireless

For the case of DBCC enabled and fwrole version 0, the local variable
wl_rinfo.dbcc_2g_phy might not be set by following for-loop, leading
uninitialized variable before using.

Addresses-Coverity-ID: 1586724 ("Uninitialized scalar variable")

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

diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index 3b3fd451e445..6da1193422fb 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -4855,6 +4855,8 @@ static void _set_btg_ctrl(struct rtw89_dev *rtwdev)
 
 	if (rtwdev->dbcc_en) {
 		if (ver->fwlrole == 0) {
+			wl_rinfo.dbcc_2g_phy = RTW89_PHY_MAX;
+
 			for (i = 0; i < RTW89_PHY_MAX; i++) {
 				if (wl_dinfo->real_band[i] == RTW89_BAND_2G)
 					wl_rinfo.dbcc_2g_phy = i;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value of _dpk_dgain_read()
  2024-09-19  8:12 [PATCH 0/3] wifi: rtw89: fix some coverity warnings Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR Ping-Ke Shih
  2024-09-19  8:12 ` [PATCH 2/3] wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl() Ping-Ke Shih
@ 2024-09-19  8:12 ` Ping-Ke Shih
  2 siblings, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2024-09-19  8:12 UTC (permalink / raw)
  To: linux-wireless

The return value of _dpk_dgain_read() is not used afterward, so remove
it safely.

Addresses-Coverity-ID: 1504753 ("Unused value")

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

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 211c051c2967..3281ee9d7523 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -2350,7 +2350,7 @@ static u8 _dpk_agc(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
 
 			if (dgain > 0x5fc || dgain < 0x556) {
 				_dpk_one_shot(rtwdev, phy, path, D_SYNC);
-				dgain = _dpk_dgain_read(rtwdev);
+				_dpk_dgain_read(rtwdev);
 			}
 
 			if (agc_cnt == 0) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR
  2024-09-19  8:12 ` [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR Ping-Ke Shih
@ 2024-09-26  1:24   ` Ping-Ke Shih
  0 siblings, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2024-09-26  1:24 UTC (permalink / raw)
  To: Ping-Ke Shih, linux-wireless

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-26  1:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19  8:12 [PATCH 0/3] wifi: rtw89: fix some coverity warnings Ping-Ke Shih
2024-09-19  8:12 ` [PATCH 1/3] wifi: rtw89: check return value of ieee80211_probereq_get() for RNR Ping-Ke Shih
2024-09-26  1:24   ` Ping-Ke Shih
2024-09-19  8:12 ` [PATCH 2/3] wifi: rtw89: coex: initialize local .dbcc_2g_phy in _set_btg_ctrl() Ping-Ke Shih
2024-09-19  8:12 ` [PATCH 3/3] wifi: rtw89: 8852c: rfk: remove unnecessary assignment of return value of _dpk_dgain_read() Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).