diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-08-23 14:55:02 +0800 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-07 15:03:37 -0400 |
commit | 6977a6b01dc14a1a3d6b70cacfc22dc83cf11984 (patch) | |
tree | efcf8942fabd8a19a1d28638c0bb82bf6e99c733 /drivers/net/wireless/orinoco | |
parent | 7949d20c133ab00ba3d2ae7b099171046aa32252 (diff) |
orinoco: use is_zero_ether_addr() instead of memcmp()
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.
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/orinoco')
-rw-r--r-- | drivers/net/wireless/orinoco/wext.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 33747e131a96..3b5508f982e8 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c @@ -7,6 +7,7 @@ #include <linux/if_arp.h> #include <linux/wireless.h> #include <linux/ieee80211.h> +#include <linux/etherdevice.h> #include <net/iw_handler.h> #include <net/cfg80211.h> #include <net/cfg80211-wext.h> @@ -159,15 +160,13 @@ static int orinoco_ioctl_setwap(struct net_device *dev, struct orinoco_private *priv = ndev_priv(dev); int err = -EINPROGRESS; /* Call commit handler */ unsigned long flags; - static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; if (orinoco_lock(priv, &flags) != 0) return -EBUSY; /* Enable automatic roaming - no sanity checks are needed */ - if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 || - memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) { + if (is_zero_ether_addr(ap_addr->sa_data) || + is_broadcast_ether_addr(ap_addr->sa_data)) { priv->bssid_fixed = 0; memset(priv->desired_bssid, 0, ETH_ALEN); |