Skip to content

Commit

Permalink
Staging: rtl8192u: use is_zero_ether_addr() instead of memcmp()
Browse files Browse the repository at this point in the history
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Wei Yongjun authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent f69ba6a commit f6aa782
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/


#include <linux/etherdevice.h>

#include "ieee80211.h"
#include "dot11d.h"
/* FIXME: add A freqs */
Expand Down Expand Up @@ -136,7 +138,6 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
{

int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;

short ifup = ieee->proto_started;//dev->flags & IFF_UP;
Expand Down Expand Up @@ -165,7 +166,7 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
spin_lock_irqsave(&ieee->lock, flags);

memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
ieee->wap_set = !is_zero_ether_addr(temp->sa_data);

spin_unlock_irqrestore(&ieee->lock, flags);

Expand Down

0 comments on commit f6aa782

Please sign in to comment.