lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <52B7C5F9.4080300@huawei.com>
Date:	Mon, 23 Dec 2013 13:11:21 +0800
From:	Ding Tianhong <dingtianhong@...wei.com>
To:	Solomon Peachy <pizza@...ftnet.org>,
	"John W. Linville" <linville@...driver.com>,
	<linux-wireless@...r.kernel.org>, Netdev <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 18/21] cw1200: slight optimization of addr compare

Use the recently added and possibly more efficient
ether_addr_equal_unaligned to instead of memcmp.

Cc: Solomon Peachy <pizza@...ftnet.org>
Cc: "John W. Linville" <linville@...driver.com>
Cc: linux-wireless@...r.kernel.org
Cc: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Weilong Chen <chenweilong@...wei.com>
Signed-off-by: Ding Tianhong <dingtianhong@...wei.com>
---
 drivers/net/wireless/cw1200/sta.c  | 4 ++--
 drivers/net/wireless/cw1200/txrx.c | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c
index 010b252..f5d1c83 100644
--- a/drivers/net/wireless/cw1200/sta.c
+++ b/drivers/net/wireless/cw1200/sta.c
@@ -555,8 +555,8 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
 		pr_debug("[STA] multicast: %pM\n", ha->addr);
 		memcpy(&priv->multicast_filter.macaddrs[count],
 		       ha->addr, ETH_ALEN);
-		if (memcmp(ha->addr, broadcast_ipv4, ETH_ALEN) &&
-		    memcmp(ha->addr, broadcast_ipv6, ETH_ALEN))
+		if (!ether_addr_equal_unaligned(ha->addr, broadcast_ipv4) &&
+		    !ether_addr_equal_unaligned(ha->addr, broadcast_ipv6))
 			priv->has_multicast_subscription = true;
 		count++;
 	}
diff --git a/drivers/net/wireless/cw1200/txrx.c b/drivers/net/wireless/cw1200/txrx.c
index e824d4d..bb9eb7b 100644
--- a/drivers/net/wireless/cw1200/txrx.c
+++ b/drivers/net/wireless/cw1200/txrx.c
@@ -816,7 +816,7 @@ static int cw1200_handle_pspoll(struct cw1200_common *priv,
 
 	if (priv->join_status != CW1200_JOIN_STATUS_AP)
 		goto done;
-	if (memcmp(priv->vif->addr, pspoll->bssid, ETH_ALEN))
+	if (!ether_addr_equal_unaligned(priv->vif->addr, pspoll->bssid))
 		goto done;
 
 	rcu_read_lock();
@@ -1166,8 +1166,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
 			return;
 	} else if (ieee80211_is_beacon(frame->frame_control) &&
 		   !arg->status && priv->vif &&
-		   !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid,
-			   ETH_ALEN)) {
+		   ether_addr_equal_unaligned(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid)) {
 		const u8 *tim_ie;
 		u8 *ies = ((struct ieee80211_mgmt *)
 			  (skb->data))->u.beacon.variable;
@@ -1314,7 +1313,7 @@ int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac)
 	int i, ret = 0;
 	spin_lock_bh(&priv->ps_state_lock);
 	for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) {
-		if (!memcmp(mac, priv->link_id_db[i].mac, ETH_ALEN) &&
+		if (ether_addr_equal_unaligned(mac, priv->link_id_db[i].mac) &&
 		    priv->link_id_db[i].status) {
 			priv->link_id_db[i].timestamp = jiffies;
 			ret = i + 1;
-- 
1.8.0


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ