diff mbox series

[2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()

Message ID 20231113144734.197359-2-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit 2c4e9acbe3a50ab4a1a2fb5eb8258befda1764cb
Delegated to: Kalle Valo
Headers show
Series [1/2] wifi: rtlwifi: more cleanup for struct rtl_hal | expand

Commit Message

Dmitry Antipov Nov. 13, 2023, 2:47 p.m. UTC
Since 'drv_priv' is an in-place member allocated at the end of
'struct ieee80211_sta', it can't be NULL and so relevant checks
in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Ping-Ke Shih Nov. 17, 2023, 3:37 a.m. UTC | #1
> -----Original Message-----
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Sent: Monday, November 13, 2023 10:48 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry
> Antipov <dmantipov@yandex.ru>
> Subject: [PATCH 2/2] wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
> 
> Since 'drv_priv' is an in-place member allocated at the end of
> 'struct ieee80211_sta', it can't be NULL and so relevant checks
> in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
> Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Kalle Valo Nov. 22, 2023, 3:02 p.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Since 'drv_priv' is an in-place member allocated at the end of
> 'struct ieee80211_sta', it can't be NULL and so relevant checks
> in 'rtl_action_proc()' and 'rtl_tx_agg_start()' may be dropped.
> Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

2c4e9acbe3a5 wifi: rtlwifi: simplify rtl_action_proc() and rtl_tx_agg_start()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index 7ce37fb4fdbf..1a8d715b7c07 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1402,10 +1402,6 @@  bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
 
 				sta_entry =
 					(struct rtl_sta_info *)sta->drv_priv;
-				if (!sta_entry) {
-					rcu_read_unlock();
-					return true;
-				}
 				capab =
 				  le16_to_cpu(mgmt->u.action.u.addba_req.capab);
 				tid = (capab &
@@ -1760,8 +1756,6 @@  int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		return -EINVAL;
 
 	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
-	if (!sta_entry)
-		return -ENXIO;
 	tid_data = &sta_entry->tids[tid];
 
 	rtl_dbg(rtlpriv, COMP_SEND, DBG_DMESG,
@@ -1818,8 +1812,6 @@  int rtl_rx_agg_start(struct ieee80211_hw *hw,
 	}
 
 	sta_entry = (struct rtl_sta_info *)sta->drv_priv;
-	if (!sta_entry)
-		return -ENXIO;
 	tid_data = &sta_entry->tids[tid];
 
 	rtl_dbg(rtlpriv, COMP_RECV, DBG_DMESG,