staging: r8712u: use is_zero_ether_addr() instead of memcmp()

Using is_zero_ether_addr() instead of directly use
memcmp(addr, "\x00\x00\x00\x00\x00\x00", ETH_ALEN)
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>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Wei Yongjun 2012-08-23 14:40:28 +08:00 committed by Greg Kroah-Hartman
parent 73ee07faee
commit 1e9ee6f7b6

View file

@ -32,6 +32,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/kmemleak.h> #include <linux/kmemleak.h>
#include <linux/etherdevice.h>
#include "osdep_service.h" #include "osdep_service.h"
#include "drv_types.h" #include "drv_types.h"
@ -331,8 +332,8 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
return _FAIL; return _FAIL;
if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast)) if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast))
return _FAIL; return _FAIL;
if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || if (is_zero_ether_addr(pattrib->bssid) ||
!memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || is_zero_ether_addr(mybssid) ||
(memcmp(pattrib->bssid, mybssid, ETH_ALEN))) (memcmp(pattrib->bssid, mybssid, ETH_ALEN)))
return _FAIL; return _FAIL;
sta_addr = pattrib->src; sta_addr = pattrib->src;
@ -409,8 +410,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast)) if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast))
return _FAIL; return _FAIL;
/* check BSSID */ /* check BSSID */
if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || if (is_zero_ether_addr(pattrib->bssid) ||
!memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || is_zero_ether_addr(mybssid) ||
(memcmp(pattrib->bssid, mybssid, ETH_ALEN))) (memcmp(pattrib->bssid, mybssid, ETH_ALEN)))
return _FAIL; return _FAIL;
if (bmcast) if (bmcast)