Commit 1ef20d57 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman

staging: rtl8712: r8712_parse_wpa_ie(): Change return values

Change return values of function r8712_parse_wpa_ie from _SUCCESS/_FAIL
to 0/-EINVAL. Modify call site accordingly.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9839208e
...@@ -283,12 +283,12 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, ...@@ -283,12 +283,12 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
if (wpa_ie_len <= 0) { if (wpa_ie_len <= 0) {
/* No WPA IE - fail silently */ /* No WPA IE - fail silently */
return _FAIL; return -EINVAL;
} }
if ((*wpa_ie != _WPA_IE_ID_) || if ((*wpa_ie != _WPA_IE_ID_) ||
(*(wpa_ie + 1) != (u8)(wpa_ie_len - 2)) || (*(wpa_ie + 1) != (u8)(wpa_ie_len - 2)) ||
(memcmp(wpa_ie + 2, (void *)WPA_OUI_TYPE, WPA_SELECTOR_LEN))) (memcmp(wpa_ie + 2, (void *)WPA_OUI_TYPE, WPA_SELECTOR_LEN)))
return _FAIL; return -EINVAL;
pos = wpa_ie; pos = wpa_ie;
pos += 8; pos += 8;
left = wpa_ie_len - 8; left = wpa_ie_len - 8;
...@@ -298,7 +298,7 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, ...@@ -298,7 +298,7 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
pos += WPA_SELECTOR_LEN; pos += WPA_SELECTOR_LEN;
left -= WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN;
} else if (left > 0) { } else if (left > 0) {
return _FAIL; return -EINVAL;
} }
/*pairwise_cipher*/ /*pairwise_cipher*/
if (left >= 2) { if (left >= 2) {
...@@ -306,16 +306,16 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, ...@@ -306,16 +306,16 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
pos += 2; pos += 2;
left -= 2; left -= 2;
if (count == 0 || left < count * WPA_SELECTOR_LEN) if (count == 0 || left < count * WPA_SELECTOR_LEN)
return _FAIL; return -EINVAL;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
*pairwise_cipher |= r8712_get_wpa_cipher_suite(pos); *pairwise_cipher |= r8712_get_wpa_cipher_suite(pos);
pos += WPA_SELECTOR_LEN; pos += WPA_SELECTOR_LEN;
left -= WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN;
} }
} else if (left == 1) { } else if (left == 1) {
return _FAIL; return -EINVAL;
} }
return _SUCCESS; return 0;
} }
int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
......
...@@ -497,7 +497,7 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie, ...@@ -497,7 +497,7 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
goto exit; goto exit;
} }
if (r8712_parse_wpa_ie(buf, ielen, &group_cipher, if (r8712_parse_wpa_ie(buf, ielen, &group_cipher,
&pairwise_cipher) == _SUCCESS) { &pairwise_cipher) == 0) {
padapter->securitypriv.AuthAlgrthm = 2; padapter->securitypriv.AuthAlgrthm = 2;
padapter->securitypriv.ndisauthtype = padapter->securitypriv.ndisauthtype =
Ndis802_11AuthModeWPAPSK; Ndis802_11AuthModeWPAPSK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment