staging: rtl8723au: Calling rtw_get_stainfo() with a NULL sta_addr will return NULL
authorJes Sorensen <Jes.Sorensen@redhat.com>
Wed, 9 Apr 2014 21:21:22 +0000 (23:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2014 15:29:23 +0000 (08:29 -0700)
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 <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_recv.c

index e448511d2f4596c9fe39c0f1301aa87e75853c58..5292bc2fd29a82ec039fda4349424a64162cfe34 100644 (file)
@@ -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 ="