mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] net/wireless/util.c: replace memcpy by ether_addr_copy
@ 2014-05-12 17:51 Fabian Frederick
  2014-05-13 13:05 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-05-12 17:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Johannes Berg, John W. Linville, akpm


Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 net/wireless/util.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index e5872ff..ab23b95 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -381,8 +381,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
 	 *   1     0   BSSID SA    DA    n/a
 	 *   1     1   RA    TA    DA    SA
 	 */
-	memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
-	memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
+	ether_addr_copy(dst, ieee80211_get_DA(hdr));
+	ether_addr_copy(src, ieee80211_get_SA(hdr));
 
 	switch (hdr->frame_control &
 		cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
@@ -458,8 +458,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
 		/* remove RFC1042 or Bridge-Tunnel encapsulation and
 		 * replace EtherType */
 		skb_pull(skb, hdrlen + 6);
-		memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
-		memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
+		ether_addr_copy(skb_push(skb, ETH_ALEN), src);
+		ether_addr_copy(skb_push(skb, ETH_ALEN), dst);
 	} else {
 		struct ethhdr *ehdr;
 		__be16 len;
@@ -467,8 +467,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
 		skb_pull(skb, hdrlen);
 		len = htons(skb->len);
 		ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
-		memcpy(ehdr->h_dest, dst, ETH_ALEN);
-		memcpy(ehdr->h_source, src, ETH_ALEN);
+		ether_addr_copy(ehdr->h_dest, dst);
+		ether_addr_copy(ehdr->h_source, src);
 		ehdr->h_proto = len;
 	}
 	return 0;
@@ -503,25 +503,25 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
 	case NL80211_IFTYPE_P2P_GO:
 		fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
 		/* DA BSSID SA */
-		memcpy(hdr.addr1, skb->data, ETH_ALEN);
-		memcpy(hdr.addr2, addr, ETH_ALEN);
-		memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN);
+		ether_addr_copy(hdr.addr1, skb->data);
+		ether_addr_copy(hdr.addr2, addr);
+		ether_addr_copy(hdr.addr3, skb->data + ETH_ALEN);
 		hdrlen = 24;
 		break;
 	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_P2P_CLIENT:
 		fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
 		/* BSSID SA DA */
-		memcpy(hdr.addr1, bssid, ETH_ALEN);
-		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
-		memcpy(hdr.addr3, skb->data, ETH_ALEN);
+		ether_addr_copy(hdr.addr1, bssid);
+		ether_addr_copy(hdr.addr2, skb->data + ETH_ALEN);
+		ether_addr_copy(hdr.addr3, skb->data);
 		hdrlen = 24;
 		break;
 	case NL80211_IFTYPE_ADHOC:
 		/* DA SA BSSID */
-		memcpy(hdr.addr1, skb->data, ETH_ALEN);
-		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
-		memcpy(hdr.addr3, bssid, ETH_ALEN);
+		ether_addr_copy(hdr.addr1, skb->data);
+		ether_addr_copy(hdr.addr2, skb->data + ETH_ALEN);
+		ether_addr_copy(hdr.addr3, bssid);
 		hdrlen = 24;
 		break;
 	default:
@@ -622,8 +622,8 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
 		unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
 
 		remaining = skb->len;
-		memcpy(dst, eth->h_dest, ETH_ALEN);
-		memcpy(src, eth->h_source, ETH_ALEN);
+		ether_addr_copy(dst, eth->h_dest);
+		ether_addr_copy(src, eth->h_source);
 
 		padding = (4 - subframe_len) & 0x3;
 		/* the last MSDU has no padding */
@@ -669,13 +669,13 @@ void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
 			/* remove RFC1042 or Bridge-Tunnel
 			 * encapsulation and replace EtherType */
 			skb_pull(frame, 6);
-			memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
-			memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
+			ether_addr_copy(skb_push(frame, ETH_ALEN), src);
+			ether_addr_copy(skb_push(frame, ETH_ALEN), dst);
 		} else {
 			memcpy(skb_push(frame, sizeof(__be16)), &len,
 				sizeof(__be16));
-			memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
-			memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
+			ether_addr_copy(skb_push(frame, ETH_ALEN), src);
+			ether_addr_copy(skb_push(frame, ETH_ALEN), dst);
 		}
 		__skb_queue_tail(list, frame);
 	}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-13 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-12 17:51 [PATCH 1/1] net/wireless/util.c: replace memcpy by ether_addr_copy Fabian Frederick
2014-05-13 13:05 ` Johannes Berg
2014-05-13 14:42   ` Fabian Frederick

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®