summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-08-26 09:04:23 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-04 14:03:40 -0700
commit0c43e56c3001fa4c55b01abf0d8a12bbc79aa148 (patch)
treec7fa234400e63c9ce15c9d23ca266792c1676943 /drivers/staging
parent78b311435195ea54c36973394dae7ff14712b1c7 (diff)
staging: rtl8192e: 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rtl8192e/rtllib_softmac.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 7c95518fb312..22a276410001 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -19,6 +19,7 @@
#include <linux/random.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
+#include <linux/etherdevice.h>
#include "dot11d.h"
short rtllib_is_54g(struct rtllib_network *net)
@@ -1843,7 +1844,7 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb,
bssid_match =
(memcmp(header->addr3, ieee->current_network.bssid, ETH_ALEN) != 0) &&
- (memcmp(header->addr3, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0);
+ (!is_broadcast_ether_addr(header->addr3));
if (bssid_match)
return -1;
@@ -3361,9 +3362,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
param->u.crypt.key_len);
return -EINVAL;
}
- if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
- param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
- param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
+ if (is_broadcast_ether_addr(param->sta_addr)) {
if (param->u.crypt.idx >= NUM_WEP_KEYS)
return -EINVAL;
crypt = &ieee->crypt_info.crypt[param->u.crypt.idx];