[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140512195114.5fca94e46368be5daaa9e56b@skynet.be>
Date: Mon, 12 May 2014 19:51:14 +0200
From: Fabian Frederick <fabf@...net.be>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Johannes Berg <johannes@...solutions.net>,
"John W. Linville" <linville@...driver.com>,
akpm <akpm@...ux-foundation.org>
Subject: [PATCH 1/1] net/wireless/util.c: replace memcpy by ether_addr_copy
Cc: Johannes Berg <johannes@...solutions.net>
Cc: "John W. Linville" <linville@...driver.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@...net.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists