Commit 7d0d2b15 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman
Browse files

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: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 514c485c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 ="