diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-08-25 20:54:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-07 15:03:39 -0400 |
commit | 35622dc26eeb1c9046df659be43b3a9316b0bf65 (patch) | |
tree | 31443d09d2535ced42b95d8d898afbfa8a36191d /drivers/net/wireless/hostap/hostap_ioctl.c | |
parent | 4653356f695900de170779fc522e2fc41d710897 (diff) |
wireless: use is_broadcast_ether_addr() instead of memcmp()
Using is_broadcast_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is broadcast
address.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 18054d9c6688..ac074731335a 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/ethtool.h> | 6 | #include <linux/ethtool.h> |
7 | #include <linux/if_arp.h> | 7 | #include <linux/if_arp.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/etherdevice.h> | ||
9 | #include <net/lib80211.h> | 10 | #include <net/lib80211.h> |
10 | 11 | ||
11 | #include "hostap_wlan.h" | 12 | #include "hostap_wlan.h" |
@@ -3221,8 +3222,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev, | |||
3221 | return -EINVAL; | 3222 | return -EINVAL; |
3222 | 3223 | ||
3223 | addr = ext->addr.sa_data; | 3224 | addr = ext->addr.sa_data; |
3224 | if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && | 3225 | if (is_broadcast_ether_addr(addr)) { |
3225 | addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { | ||
3226 | sta_ptr = NULL; | 3226 | sta_ptr = NULL; |
3227 | crypt = &local->crypt_info.crypt[i]; | 3227 | crypt = &local->crypt_info.crypt[i]; |
3228 | } else { | 3228 | } else { |
@@ -3394,8 +3394,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev, | |||
3394 | i--; | 3394 | i--; |
3395 | 3395 | ||
3396 | addr = ext->addr.sa_data; | 3396 | addr = ext->addr.sa_data; |
3397 | if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && | 3397 | if (is_broadcast_ether_addr(addr)) { |
3398 | addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { | ||
3399 | sta_ptr = NULL; | 3398 | sta_ptr = NULL; |
3400 | crypt = &local->crypt_info.crypt[i]; | 3399 | crypt = &local->crypt_info.crypt[i]; |
3401 | } else { | 3400 | } else { |
@@ -3458,9 +3457,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local, | |||
3458 | param->u.crypt.key_len) | 3457 | param->u.crypt.key_len) |
3459 | return -EINVAL; | 3458 | return -EINVAL; |
3460 | 3459 | ||
3461 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && | 3460 | if (is_broadcast_ether_addr(param->sta_addr)) { |
3462 | param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && | ||
3463 | param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { | ||
3464 | if (param->u.crypt.idx >= WEP_KEYS) | 3461 | if (param->u.crypt.idx >= WEP_KEYS) |
3465 | return -EINVAL; | 3462 | return -EINVAL; |
3466 | sta_ptr = NULL; | 3463 | sta_ptr = NULL; |
@@ -3593,9 +3590,7 @@ static int prism2_ioctl_get_encryption(local_info_t *local, | |||
3593 | if (max_key_len < 0) | 3590 | if (max_key_len < 0) |
3594 | return -EINVAL; | 3591 | return -EINVAL; |
3595 | 3592 | ||
3596 | if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && | 3593 | if (is_broadcast_ether_addr(param->sta_addr)) { |
3597 | param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && | ||
3598 | param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { | ||
3599 | sta_ptr = NULL; | 3594 | sta_ptr = NULL; |
3600 | if (param->u.crypt.idx >= WEP_KEYS) | 3595 | if (param->u.crypt.idx >= WEP_KEYS) |
3601 | param->u.crypt.idx = local->crypt_info.tx_keyidx; | 3596 | param->u.crypt.idx = local->crypt_info.tx_keyidx; |