Skip to contentSkip to conversation

staging: rtl8723au: fix static checker warning

PATCH In review Geliang Tang 2 participants 2 messages Mar 1, 2016 – Mar 2, 2016 1 message not in the archive Staging

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 staging: rtl8723au: fix static checker warning

In reply to a message not in the archive

Fix the following static checker warning:

drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a()
error: potential NULL dereference 'psta'.

Fixes e280d71("staging: rtl8723au: use list_for_each_entry*()")
---
 drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_sta_mgt.c +4 -2
index 22d857b..5f85ee0 100644
@@ -346,7 +346,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
 struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
 {
 	struct list_head *phead;
-	struct sta_info *psta = NULL;
+	struct sta_info *pos, *psta = NULL;
 	u32 index;
 	const u8 *addr;
 
@@ -362,7 +362,9 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
 
 	spin_lock_bh(&pstapriv->sta_hash_lock);
 	phead = &pstapriv->sta_hash[index];
-	list_for_each_entry(psta, phead, hash_list) {
+	list_for_each_entry(pos, phead, hash_list) {
+		psta = pos;
+
 		/*  if found the matched address */
 		if (ether_addr_equal(psta->hwaddr, addr))
 			break;
Signature · 1 line
2.5.0
#2 lore raw
Quoted 7 lines · Geliang Tang

Fix the following static checker warning:

drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a()
error: potential NULL dereference 'psta'.

Fixes e280d71("staging: rtl8723au: use list_for_each_entry*()")

Looks good. Thanks.

regards,
dan carpenter