summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/rndis_wlan.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2012-02-29 18:25:00 +0400
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 00:23:17 +0400
commitf096ce6d244a380a78e19a7d7a25d9a4a6a6c9b7 (patch)
tree1d3a07e6494f74322bb202cb11e7856fd5fbad2f /drivers/net/wireless/rndis_wlan.c
parentf808e4ad05704d4ba0082fbb27640294c6fa4eae (diff)
downloadlinux-f096ce6d244a380a78e19a7d7a25d9a4a6a6c9b7.tar.xz
rndis_wlan: use RNDIS_WLAN_NUM_KEYS for all key index checks
Use new RNDIS_WLAN_NUM_KEYS for checks in add_wep_key() and add_wpa_key(). Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r--drivers/net/wireless/rndis_wlan.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index c831c1f2bd07..0e238400b046 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1387,13 +1387,15 @@ static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len,
netdev_dbg(usbdev->net, "%s(idx: %d, len: %d)\n",
__func__, index, key_len);
- if ((key_len != 5 && key_len != 13) || index < 0 || index > 3)
+ if (index < 0 || index >= RNDIS_WLAN_NUM_KEYS)
return -EINVAL;
if (key_len == 5)
cipher = WLAN_CIPHER_SUITE_WEP40;
- else
+ else if (key_len == 13)
cipher = WLAN_CIPHER_SUITE_WEP104;
+ else
+ return -EINVAL;
memset(&ndis_key, 0, sizeof(ndis_key));
@@ -1436,7 +1438,7 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len,
bool is_addr_ok;
int ret;
- if (index < 0 || index >= 4) {
+ if (index < 0 || index >= RNDIS_WLAN_NUM_KEYS) {
netdev_dbg(usbdev->net, "%s(): index out of range (%i)\n",
__func__, index);
return -EINVAL;