From 7d0d2b15a0e06ce18c5fd69c4c9692f5670aa9d4 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 9 Apr 2014 23:21:22 +0200 Subject: [PATCH] staging: rtl8723au: Calling rtw_get_stainfo() with a NULL sta_addr will return NULL This makes the follow-on check for psta != NULL pointless and makes the whole exercise rather pointless. This is another case of why blindly zero-initializing variables when they are declared is bad. This bug seems to be present in multiple drivers provided by Realtek. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index e448511d2f45..5292bc2fd29a 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -569,7 +569,7 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter, static struct recv_frame *portctrl(struct rtw_adapter *adapter, struct recv_frame *precv_frame) { - u8 *psta_addr = NULL, *ptr; + u8 *psta_addr, *ptr; uint auth_alg; struct recv_frame *pfhdr; struct sta_info *psta; @@ -580,7 +580,6 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, struct rx_pkt_attrib *pattrib; pstapriv = &adapter->stapriv; - psta = rtw_get_stainfo23a(pstapriv, psta_addr); auth_alg = adapter->securitypriv.dot11AuthAlgrthm; @@ -588,6 +587,7 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, pfhdr = precv_frame; pattrib = &pfhdr->attrib; psta_addr = pattrib->ta; + psta = rtw_get_stainfo23a(pstapriv, psta_addr); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm =" -- 2.30.2