rtl8192e driver uses memcpy() to copy hw addresses in several places. checkpatch.pl suggests to use ether_addr_copy(), but most of addresses in driver may be unaligned. This patch replaces all memcpy occurences with single macro therby silencing checkpatch.pl (single complaints in macro remains). Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@xxxxxxxxx> --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 12 ++--- drivers/staging/rtl8192e/rtllib.h | 3 ++ drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 18 +++---- drivers/staging/rtl8192e/rtllib_rx.c | 74 +++++++++++++++++----------- drivers/staging/rtl8192e/rtllib_softmac.c | 67 +++++++++++++------------ drivers/staging/rtl8192e/rtllib_softmac_wx.c | 5 +- drivers/staging/rtl8192e/rtllib_tx.c | 24 ++++----- 7 files changed, 113 insertions(+), 90 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 26258ea..5b2141f 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -103,10 +103,10 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, BAReq = (struct rtllib_hdr_3addr *)skb_put(skb, sizeof(struct rtllib_hdr_3addr)); - memcpy(BAReq->addr1, Dst, ETH_ALEN); - memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN); + ether_addr_copy_unaligned(BAReq->addr1, Dst); + ether_addr_copy_unaligned(BAReq->addr2, ieee->dev->dev_addr); - memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(BAReq->addr3, ieee->current_network.bssid); BAReq->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); tag = (u8 *)skb_put(skb, 9); @@ -167,9 +167,9 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, Delba = (struct rtllib_hdr_3addr *) skb_put(skb, sizeof(struct rtllib_hdr_3addr)); - memcpy(Delba->addr1, dst, ETH_ALEN); - memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(Delba->addr1, dst); + ether_addr_copy_unaligned(Delba->addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(Delba->addr3, ieee->current_network.bssid); Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); tag = (u8 *)skb_put(skb, 6); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 3c8b708..472e880 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -2972,4 +2972,7 @@ extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p); #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex) #endif +/* TODO: replace with aligned calls where possible */ +#define ether_addr_copy_unaligned(dst, src) memcpy(dst, src, ETH_ALEN) + #endif /* RTLLIB_H */ diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 656b4b3..c3eed40 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -532,20 +532,20 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) switch (le16_to_cpu(hdr11->frame_ctl) & (RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS)) { case RTLLIB_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + ether_addr_copy_unaligned(hdr, hdr11->addr3); /* DA */ + ether_addr_copy_unaligned(hdr + ETH_ALEN, hdr11->addr2); /* SA */ break; case RTLLIB_FCTL_FROMDS: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ + ether_addr_copy_unaligned(hdr, hdr11->addr1); /* DA */ + ether_addr_copy_unaligned(hdr + ETH_ALEN, hdr11->addr3); /* SA */ break; case RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ + ether_addr_copy_unaligned(hdr, hdr11->addr3); /* DA */ + ether_addr_copy_unaligned(hdr + ETH_ALEN, hdr11->addr4); /* SA */ break; case 0: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + ether_addr_copy_unaligned(hdr, hdr11->addr1); /* DA */ + ether_addr_copy_unaligned(hdr + ETH_ALEN, hdr11->addr2); /* SA */ break; } @@ -598,7 +598,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev, else ev.flags |= IW_MICFAILURE_PAIRWISE; ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); + ether_addr_copy_unaligned(ev.src_addr.sa_data, hdr->addr2); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = sizeof(ev); wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index bb789cc..67f45af 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -139,8 +139,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, entry->seq = seq; entry->last_frag = frag; entry->skb = skb; - memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); - memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); + ether_addr_copy_unaligned(entry->src_addr, hdr->addr2); + ether_addr_copy_unaligned(entry->dst_addr, hdr->addr1); } else { /* received a fragment of a frame for which the head fragment * should have already been received @@ -400,7 +400,7 @@ static int is_duplicate_packet(struct rtllib_device *ieee, if (!entry) return 0; - memcpy(entry->mac, mac, ETH_ALEN); + ether_addr_copy_unaligned(entry->mac, mac); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; entry->packet_time[tid] = jiffies; @@ -488,15 +488,23 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx * and replace EtherType */ skb_pull(sub_skb, SNAP_SIZE); - memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + prxb->src); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + prxb->dst); } else { u16 len; /* Leave Ethernet header part of hdr and full payload */ len = sub_skb->len; memcpy(skb_push(sub_skb, 2), &len, 2); - memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + prxb->src); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + prxb->dst); } /* Indicate the packets to upper layer */ @@ -781,15 +789,15 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, rxb->subframes[0] = sub_skb; - memcpy(rxb->src, src, ETH_ALEN); - memcpy(rxb->dst, dst, ETH_ALEN); + ether_addr_copy_unaligned(rxb->src, src); + ether_addr_copy_unaligned(rxb->dst, dst); rxb->subframes[0]->dev = ieee->dev; return 1; } rxb->nr_subframes = 0; - memcpy(rxb->src, src, ETH_ALEN); - memcpy(rxb->dst, dst, ETH_ALEN); + ether_addr_copy_unaligned(rxb->src, src); + ether_addr_copy_unaligned(rxb->dst, dst); while (skb->len > ETHERNET_HEADER_SIZE) { /* Offset 12 denote 2 mac address */ nSubframe_Length = *((u16 *)(skb->data + 12)); @@ -927,24 +935,24 @@ static void rtllib_rx_extract_addr(struct rtllib_device *ieee, switch (fc & (RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS)) { case RTLLIB_FCTL_FROMDS: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr3, ETH_ALEN); - memcpy(bssid, hdr->addr2, ETH_ALEN); + ether_addr_copy_unaligned(dst, hdr->addr1); + ether_addr_copy_unaligned(src, hdr->addr3); + ether_addr_copy_unaligned(bssid, hdr->addr2); break; case RTLLIB_FCTL_TODS: - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid, hdr->addr1, ETH_ALEN); + ether_addr_copy_unaligned(dst, hdr->addr3); + ether_addr_copy_unaligned(src, hdr->addr2); + ether_addr_copy_unaligned(bssid, hdr->addr1); break; case RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS: - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr4, ETH_ALEN); - memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(dst, hdr->addr3); + ether_addr_copy_unaligned(src, hdr->addr4); + ether_addr_copy_unaligned(bssid, ieee->current_network.bssid); break; case 0: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid, hdr->addr3, ETH_ALEN); + ether_addr_copy_unaligned(dst, hdr->addr1); + ether_addr_copy_unaligned(src, hdr->addr2); + ether_addr_copy_unaligned(bssid, hdr->addr3); break; } } @@ -1218,15 +1226,23 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, * replace EtherType */ skb_pull(sub_skb, SNAP_SIZE); - memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + src); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + dst); } else { u16 len; /* Leave Ethernet header part of hdr and full payload */ len = sub_skb->len; memcpy(skb_push(sub_skb, 2), &len, 2); - memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + src); + ether_addr_copy_unaligned(skb_push(sub_skb, + ETH_ALEN), + dst); } ieee->stats.rx_packets++; @@ -2046,7 +2062,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, if (network->MBssidMask != 0) { network->bMBssidValid = true; network->MBssidMask = 0xff << (network->MBssidMask); - memcpy(network->MBssid, network->bssid, ETH_ALEN); + ether_addr_copy_unaligned(network->MBssid, network->bssid); network->MBssid[5] &= network->MBssidMask; } else { network->bMBssidValid = false; @@ -2206,7 +2222,7 @@ static inline int rtllib_network_init( memset(&network->qos_data, 0, sizeof(struct rtllib_qos_data)); /* Pull out fixed field data */ - memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); + ether_addr_copy_unaligned(network->bssid, beacon->header.addr3); network->capability = le16_to_cpu(beacon->capability); network->last_scanned = jiffies; network->time_stamp[0] = beacon->time_stamp[0]; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 23b7a4c..29c23ff 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -371,7 +371,7 @@ static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) req->header.duration_id = 0; memset(req->header.addr1, 0xff, ETH_ALEN); - memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + ether_addr_copy_unaligned(req->header.addr2, ieee->dev->dev_addr); memset(req->header.addr3, 0xff, ETH_ALEN); tag = (u8 *) skb_put(skb, len + 2 + rate_len); @@ -814,9 +814,9 @@ inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon, auth->header.frame_ctl |= cpu_to_le16(RTLLIB_FCTL_WEP); auth->header.duration_id = cpu_to_le16(0x013a); - memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); - memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); + ether_addr_copy_unaligned(auth->header.addr1, beacon->bssid); + ether_addr_copy_unaligned(auth->header.addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(auth->header.addr3, beacon->bssid); if (ieee->auth_mode == 0) auth->algorithm = WLAN_AUTH_OPEN; else if (ieee->auth_mode == 1) @@ -907,9 +907,11 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) beacon_buf = (struct rtllib_probe_response *) skb_put(skb, (beacon_size - ieee->tx_headroom)); - memcpy(beacon_buf->header.addr1, dest, ETH_ALEN); - memcpy(beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(beacon_buf->header.addr1, dest); + ether_addr_copy_unaligned(beacon_buf->header.addr2, + ieee->dev->dev_addr); + ether_addr_copy_unaligned(beacon_buf->header.addr3, + ieee->current_network.bssid); beacon_buf->header.duration_id = 0; beacon_buf->beacon_interval = @@ -1004,9 +1006,9 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) skb_put(skb, sizeof(struct rtllib_assoc_response_frame)); assoc->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_ASSOC_RESP); - memcpy(assoc->header.addr1, dest, ETH_ALEN); - memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); - memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + ether_addr_copy_unaligned(assoc->header.addr1, dest); + ether_addr_copy_unaligned(assoc->header.addr3, ieee->dev->dev_addr); + ether_addr_copy_unaligned(assoc->header.addr2, ieee->dev->dev_addr); assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? WLAN_CAPABILITY_ESS : WLAN_CAPABILITY_IBSS); @@ -1061,9 +1063,9 @@ static struct sk_buff *rtllib_auth_resp(struct rtllib_device *ieee, int status, auth->transaction = cpu_to_le16(2); auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); - memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); - memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(auth->header.addr1, dest, ETH_ALEN); + ether_addr_copy_unaligned(auth->header.addr3, ieee->dev->dev_addr); + ether_addr_copy_unaligned(auth->header.addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(auth->header.addr1, dest); auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH); return skb; @@ -1084,9 +1086,9 @@ static struct sk_buff *rtllib_null_func(struct rtllib_device *ieee, short pwr) hdr = (struct rtllib_hdr_3addr *)skb_put(skb, sizeof(struct rtllib_hdr_3addr)); - memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); - memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(hdr->addr1, ieee->current_network.bssid); + ether_addr_copy_unaligned(hdr->addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(hdr->addr3, ieee->current_network.bssid); hdr->frame_ctl = cpu_to_le16(RTLLIB_FTYPE_DATA | RTLLIB_STYPE_NULLFUNC | RTLLIB_FCTL_TODS | @@ -1111,8 +1113,8 @@ static struct sk_buff *rtllib_pspoll_func(struct rtllib_device *ieee) hdr = (struct rtllib_pspoll_hdr *)skb_put(skb, sizeof(struct rtllib_pspoll_hdr)); - memcpy(hdr->bssid, ieee->current_network.bssid, ETH_ALEN); - memcpy(hdr->ta, ieee->dev->dev_addr, ETH_ALEN); + ether_addr_copy_unaligned(hdr->bssid, ieee->current_network.bssid); + ether_addr_copy_unaligned(hdr->ta, ieee->dev->dev_addr); hdr->aid = cpu_to_le16(ieee->assoc_id | 0xc000); hdr->frame_ctl = cpu_to_le16(RTLLIB_FTYPE_CTL | RTLLIB_STYPE_PSPOLL | @@ -1264,11 +1266,11 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, hdr->header.frame_ctl = RTLLIB_STYPE_ASSOC_REQ; hdr->header.duration_id = cpu_to_le16(37); - memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); - memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); + ether_addr_copy_unaligned(hdr->header.addr1, beacon->bssid); + ether_addr_copy_unaligned(hdr->header.addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(hdr->header.addr3, beacon->bssid); - memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN); + ether_addr_copy_unaligned(ieee->ap_mac_addr, beacon->bssid); hdr->capability = cpu_to_le16(WLAN_CAPABILITY_ESS); if (beacon->capability & WLAN_CAPABILITY_PRIVACY) @@ -1828,7 +1830,7 @@ static int auth_rq_parse(struct sk_buff *skb, u8 *dest) } a = (struct rtllib_authentication *) skb->data; - memcpy(dest, a->header.addr2, ETH_ALEN); + ether_addr_copy_unaligned(dest, a->header.addr2); if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; @@ -1856,7 +1858,7 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb, if (bssid_match) return -1; - memcpy(src, header->addr2, ETH_ALEN); + ether_addr_copy_unaligned(src, header->addr2); skbend = (u8 *)skb->data + skb->len; @@ -1895,7 +1897,7 @@ static int assoc_rq_parse(struct sk_buff *skb, u8 *dest) a = (struct rtllib_assoc_request_frame *) skb->data; - memcpy(dest, a->header.addr2, ETH_ALEN); + ether_addr_copy_unaligned(dest, a->header.addr2); return 0; } @@ -2650,7 +2652,8 @@ void rtllib_start_master_bss(struct rtllib_device *ieee) ieee->ssid_set = 1; } - memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); + ether_addr_copy_unaligned(ieee->current_network.bssid, + ieee->dev->dev_addr); ieee->set_chan(ieee->dev, ieee->current_network.channel); ieee->state = RTLLIB_LINKED; @@ -3517,9 +3520,9 @@ inline struct sk_buff *rtllib_disauth_skb(struct rtllib_network *beacon, disauth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DEAUTH); disauth->header.duration_id = 0; - memcpy(disauth->header.addr1, beacon->bssid, ETH_ALEN); - memcpy(disauth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(disauth->header.addr3, beacon->bssid, ETH_ALEN); + ether_addr_copy_unaligned(disauth->header.addr1, beacon->bssid); + ether_addr_copy_unaligned(disauth->header.addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(disauth->header.addr3, beacon->bssid); disauth->reason = cpu_to_le16(asRsn); return skb; @@ -3544,9 +3547,9 @@ inline struct sk_buff *rtllib_disassociate_skb(struct rtllib_network *beacon, disass->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_DISASSOC); disass->header.duration_id = 0; - memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN); - memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN); + ether_addr_copy_unaligned(disass->header.addr1, beacon->bssid); + ether_addr_copy_unaligned(disass->header.addr2, ieee->dev->dev_addr); + ether_addr_copy_unaligned(disass->header.addr3, beacon->bssid); disass->reason = cpu_to_le16(asRsn); return skb; diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 9715a79..b18382b 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -160,7 +160,8 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee, if (is_zero_ether_addr(temp->sa_data)) { spin_lock_irqsave(&ieee->lock, flags); - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); + ether_addr_copy_unaligned(ieee->current_network.bssid, + temp->sa_data); ieee->wap_set = 0; spin_unlock_irqrestore(&ieee->lock, flags); ret = -1; @@ -177,7 +178,7 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee, spin_lock_irqsave(&ieee->lock, flags); ieee->cannot_notify = false; - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); + ether_addr_copy_unaligned(ieee->current_network.bssid, temp->sa_data); ieee->wap_set = !is_zero_ether_addr(temp->sa_data); spin_unlock_irqrestore(&ieee->lock, flags); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 3b15963..a750b28 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -608,8 +608,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) goto success; } /* Save source and destination addresses */ - memcpy(dest, skb->data, ETH_ALEN); - memcpy(src, skb->data+ETH_ALEN, ETH_ALEN); + ether_addr_copy_unaligned(dest, skb->data); + ether_addr_copy_unaligned(src, skb->data+ETH_ALEN); memset(skb->cb, 0, sizeof(skb->cb)); ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); @@ -694,22 +694,22 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* To DS: Addr1 = BSSID, Addr2 = SA, * Addr3 = DA */ - memcpy(&header.addr1, ieee->current_network.bssid, - ETH_ALEN); - memcpy(&header.addr2, &src, ETH_ALEN); + ether_addr_copy_unaligned(&header.addr1, + ieee->current_network.bssid); + ether_addr_copy_unaligned(&header.addr2, &src); if (IsAmsdu) - memcpy(&header.addr3, - ieee->current_network.bssid, ETH_ALEN); + ether_addr_copy_unaligned(&header.addr3, + ieee->current_network.bssid); else - memcpy(&header.addr3, &dest, ETH_ALEN); + ether_addr_copy_unaligned(&header.addr3, &dest); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, * Addr3 = BSSID */ - memcpy(&header.addr1, dest, ETH_ALEN); - memcpy(&header.addr2, src, ETH_ALEN); - memcpy(&header.addr3, ieee->current_network.bssid, - ETH_ALEN); + ether_addr_copy_unaligned(&header.addr1, dest); + ether_addr_copy_unaligned(&header.addr2, src); + ether_addr_copy_unaligned(&header.addr3, + ieee->current_network.bssid); } bIsMulticast = is_multicast_ether_addr(header.addr1); -- 1.8.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel