Commit dc13498a authored by Quytelda Kahja's avatar Quytelda Kahja Committed by Greg Kroah-Hartman

staging: ks7010: Use constants from ieee80211_eid instead of literal ints.

The case statement in get_ap_information() should not use literal integers
to parse information element IDs when these values are provided by name
in 'enum ieee80211_eid' in the header 'linux/ieee80211.h'.
Signed-off-by: default avatarQuytelda Kahja <quytelda@tamalin.org>
Reviewed-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bd082af
...@@ -251,9 +251,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, ...@@ -251,9 +251,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info,
offset = 0; offset = 0;
while (bsize > offset) { while (bsize > offset) {
/* DPRINTK(4, "Element ID=%d\n",*bp); */ switch (*bp) { /* Information Element ID */
switch (*bp) { case WLAN_EID_SSID:
case 0: /* ssid */
if (*(bp + 1) <= SSID_MAX_SIZE) { if (*(bp + 1) <= SSID_MAX_SIZE) {
ap->ssid.size = *(bp + 1); ap->ssid.size = *(bp + 1);
} else { } else {
...@@ -263,8 +262,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, ...@@ -263,8 +262,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info,
} }
memcpy(ap->ssid.body, bp + 2, ap->ssid.size); memcpy(ap->ssid.body, bp + 2, ap->ssid.size);
break; break;
case 1: /* rate */ case WLAN_EID_SUPP_RATES:
case 50: /* ext rate */ case WLAN_EID_EXT_SUPP_RATES:
if ((*(bp + 1) + ap->rate_set.size) <= if ((*(bp + 1) + ap->rate_set.size) <=
RATE_SET_MAX_SIZE) { RATE_SET_MAX_SIZE) {
memcpy(&ap->rate_set.body[ap->rate_set.size], memcpy(&ap->rate_set.body[ap->rate_set.size],
...@@ -280,9 +279,9 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, ...@@ -280,9 +279,9 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info,
(RATE_SET_MAX_SIZE - ap->rate_set.size); (RATE_SET_MAX_SIZE - ap->rate_set.size);
} }
break; break;
case 3: /* DS parameter */ case WLAN_EID_DS_PARAMS:
break; break;
case 48: /* RSN(WPA2) */ case WLAN_EID_RSN:
ap->rsn_ie.id = *bp; ap->rsn_ie.id = *bp;
if (*(bp + 1) <= RSN_IE_BODY_MAX) { if (*(bp + 1) <= RSN_IE_BODY_MAX) {
ap->rsn_ie.size = *(bp + 1); ap->rsn_ie.size = *(bp + 1);
...@@ -293,8 +292,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, ...@@ -293,8 +292,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info,
} }
memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size); memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size);
break; break;
case 221: /* WPA */ case WLAN_EID_VENDOR_SPECIFIC: /* WPA */
if (memcmp(bp + 2, "\x00\x50\xf2\x01", 4) == 0) { /* WPA OUI check */ if (memcmp(bp + 2, "\x00\x50\xf2\x01", 4) == 0) { /* WPA OUI check */
ap->wpa_ie.id = *bp; ap->wpa_ie.id = *bp;
if (*(bp + 1) <= RSN_IE_BODY_MAX) { if (*(bp + 1) <= RSN_IE_BODY_MAX) {
ap->wpa_ie.size = *(bp + 1); ap->wpa_ie.size = *(bp + 1);
...@@ -309,18 +308,18 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, ...@@ -309,18 +308,18 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info,
} }
break; break;
case 2: /* FH parameter */ case WLAN_EID_FH_PARAMS:
case 4: /* CF parameter */ case WLAN_EID_CF_PARAMS:
case 5: /* TIM */ case WLAN_EID_TIM:
case 6: /* IBSS parameter */ case WLAN_EID_IBSS_PARAMS:
case 7: /* Country */ case WLAN_EID_COUNTRY:
case 42: /* ERP information */ case WLAN_EID_ERP_INFO:
case 47: /* Reserve ID 47 Broadcom AP */
break; break;
default: default:
DPRINTK(4, "unknown Element ID=%d\n", *bp); DPRINTK(4, "unknown Element ID=%d\n", *bp);
break; break;
} }
offset += 2; /* id & size field */ offset += 2; /* id & size field */
offset += *(bp + 1); /* +size offset */ offset += *(bp + 1); /* +size offset */
bp += (*(bp + 1) + 2); /* pointer update */ bp += (*(bp + 1) + 2); /* pointer update */
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define _KS_HOSTIF_H_ #define _KS_HOSTIF_H_
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/ieee80211.h>
/* /*
* HOST-MAC I/F events * HOST-MAC I/F events
......
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