Skip to contentSkip to conversation

staging: rtl8188eu: Skip unnecessary field checks

PATCH In review Aymen Qader 2 participants 2 messages Sep 27, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8188eu: Skip unnecessary field checks

Skip unnecessary request field checks when the information element pointer is null.

---
v2: combine pointer check and length check & change commit message to be more appropriate

 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +3 -3
index 834053a0ae9d..4d55bbdf8fb7 100644
@@ -2971,11 +2971,11 @@ static unsigned int OnAssocReq(struct adapter *padapter,
 	/*  checking SSID */
 	p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SSID_IE_, &ie_len,
 		pkt_len - WLAN_HDR_A3_LEN - ie_offset);
-	if (!p)
-		status = _STATS_FAILURE_;
 
-	if (ie_len == 0) { /*  broadcast ssid, however it is not allowed in assocreq */
+	if (!p || ie_len == 0) {
+		/*  broadcast ssid, however it is not allowed in assocreq */
 		status = _STATS_FAILURE_;
+		goto OnAssocReqFail;
 	} else {
 		/*  check if ssid match */
 		if (memcmp((void *)(p+2), cur->Ssid.Ssid, cur->Ssid.SsidLength))
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#1 lore raw
Quoted 21 lines · Aymen Qader

Skip unnecessary request field checks when the information element pointer is null.

---
v2: combine pointer check and length check & change commit message to be more appropriate

  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +0 -1
index 834053a0ae9d..4d55bbdf8fb7 100644
@@ -2971,11 +2971,11 @@ static unsigned int OnAssocReq(struct adapter *padapter,
  	/*  checking SSID */
  	p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SSID_IE_, &ie_len,
  		pkt_len - WLAN_HDR_A3_LEN - ie_offset);
-	if (!p)

drivers/staging/rtl8188eu/core/rtw_mlme_ext.c static unsigned int OnAssocReq(struct adapter *padapter, · line 2981

Quoted 10 lines
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +3 -2
-		status = _STATS_FAILURE_;
 
-	if (ie_len == 0) { /*  broadcast ssid, however it is not allowed in assocreq */
+	if (!p || ie_len == 0) {
+		/*  broadcast ssid, however it is not allowed in assocreq */
  		status = _STATS_FAILURE_;
+		goto OnAssocReqFail;
  	} else {
  		/*  check if ssid match */
  		if (memcmp((void *)(p+2), cur->Ssid.Ssid, cur->Ssid.SsidLength))