mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Pithon <denis.pithon@gmail.com>
To: gregkh@linuxfoundation.org
Cc: vitaly.osipov@gmail.com, ztugcesirin@gmail.com,
	josh@joshtriplett.org, himangi774@gmail.com,
	superna9999@gmail.com, paul.gortmaker@windriver.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging/wlan-ng: use ether_addr_equal_unaligned
Date: Sun,  1 Jun 2014 09:22:05 +0200	[thread overview]
Message-ID: <1401607325-32733-1-git-send-email-denis.pithon@gmail.com> (raw)

This patch get rid of all memcmp() on ethernet addresses in wlan-ng.
Replaced with ether_addr_equal_unaligned().

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211conv.c |  6 +++---
 drivers/staging/wlan-ng/prism2sta.c  | 16 +++++++++-------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c
index 913676e..fb8a628 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -241,7 +241,7 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac,
 
 	for (i = 0; i < wlandev->spy_number; i++) {
 
-		if (!memcmp(wlandev->spy_address[i], mac, ETH_ALEN)) {
+		if (ether_addr_equal_unaligned(wlandev->spy_address[i], mac)) {
 			memcpy(wlandev->spy_address[i], mac, ETH_ALEN);
 			wlandev->spy_stat[i].level = rxmeta->signal;
 			wlandev->spy_stat[i].noise = rxmeta->noise;
@@ -359,8 +359,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
 	/* Test for the various encodings */
 	if ((payload_length >= sizeof(struct wlan_ethhdr)) &&
 	    (e_llc->dsap != 0xaa || e_llc->ssap != 0xaa) &&
-	    ((memcmp(daddr, e_hdr->daddr, WLAN_ETHADDR_LEN) == 0) ||
-	     (memcmp(saddr, e_hdr->saddr, WLAN_ETHADDR_LEN) == 0))) {
+	    (ether_addr_equal_unaligned(daddr, e_hdr->daddr) ||
+	     ether_addr_equal_unaligned(saddr, e_hdr->saddr))) {
 		pr_debug("802.3 ENCAP len: %d\n", payload_length);
 		/* 802.3 Encapsulated */
 		/* Test for an overlength frame */
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 278b6a1..d2e492c 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -56,6 +56,7 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/etherdevice.h>
 #include <linux/wireless.h>
 #include <linux/netdevice.h>
 #include <linux/workqueue.h>
@@ -1505,7 +1506,8 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
 	 */
 
 	for (i = 0; i < hw->authlist.cnt; i++)
-		if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
+		if (ether_addr_equal_unaligned(rec.sta_addr,
+					       hw->authlist.addr[i]))
 			break;
 
 	if (i >= hw->authlist.cnt) {
@@ -1587,8 +1589,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 		 */
 
 		for (i = 0; i < hw->authlist.cnt; i++)
-			if (memcmp(rec.address, hw->authlist.addr[i],
-				   ETH_ALEN) == 0) {
+			if (ether_addr_equal_unaligned(rec.address,
+						       hw->authlist.addr[i])) {
 				rec.status = P80211ENUM_status_successful;
 				break;
 			}
@@ -1625,7 +1627,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 		}
 
 		for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-			if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+			if (ether_addr_equal_unaligned(rec.address, addr)) {
 				rec.status = P80211ENUM_status_successful;
 				break;
 			}
@@ -1655,7 +1657,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 		rec.status = P80211ENUM_status_successful;
 
 		for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-			if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+			if (ether_addr_equal_unaligned(rec.address, addr)) {
 				rec.status = P80211ENUM_status_unspec_failure;
 				break;
 			}
@@ -1676,8 +1678,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 
 	if (rec.status == P80211ENUM_status_successful) {
 		for (i = 0; i < hw->authlist.cnt; i++)
-			if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
-			    == 0)
+			if (ether_addr_equal_unaligned(rec.address,
+						       hw->authlist.addr[i]))
 				break;
 
 		if (i >= hw->authlist.cnt) {
-- 
1.9.0


             reply	other threads:[~2014-06-01  7:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01  7:22 Denis Pithon [this message]
2014-06-01  9:35 ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401607325-32733-1-git-send-email-denis.pithon@gmail.com \
    --to=denis.pithon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himangi774@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=superna9999@gmail.com \
    --cc=vitaly.osipov@gmail.com \
    --cc=ztugcesirin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®