* [PATCH] staging: rtl8723au: fix static checker warning
[not found] <20160223050421.GA19763@mwanda>
@ 2016-03-01 15:22 ` Geliang Tang
2016-03-02 13:55 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2016-03-01 15:22 UTC (permalink / raw)
To: Larry Finger, Jes Sorensen, Greg Kroah-Hartman, Julian Calaby,
Dan Carpenter
Cc: Geliang Tang, linux-wireless, devel, linux-kernel
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*()")
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index 22d857b..5f85ee0 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -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;
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8723au: fix static checker warning
2016-03-01 15:22 ` [PATCH] staging: rtl8723au: fix static checker warning Geliang Tang
@ 2016-03-02 13:55 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2016-03-02 13:55 UTC (permalink / raw)
To: Geliang Tang
Cc: Larry Finger, Jes Sorensen, Greg Kroah-Hartman, Julian Calaby,
devel, linux-wireless, linux-kernel
On Tue, Mar 01, 2016 at 11:22:23PM +0800, Geliang Tang wrote:
> 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*()")
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Looks good. Thanks.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-02 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20160223050421.GA19763@mwanda>
2016-03-01 15:22 ` [PATCH] staging: rtl8723au: fix static checker warning Geliang Tang
2016-03-02 13:55 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.