* [PATCH] staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet addresses are __aligned(2)
@ 2016-09-16 21:27 sayli karnik
2016-09-17 5:44 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: sayli karnik @ 2016-09-16 21:27 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Greg Kroah-Hartman
This patch fixes the checkpatch warning:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are
__aligned(2).
Done using coccinelle:
@@
expression exp1, exp2;
@@
- memcpy(exp1, exp2, ETH_ALEN);
+ ether_addr_copy(exp1, exp2);
Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 89 ++++++++++++++-------------
1 file changed, 46 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 9544e55..fa8a5ca 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -353,9 +353,9 @@ static void issue_beacon(struct adapter *padapter, int timeout_ms)
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, cur_network->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, bc_addr);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, cur_network->MacAddress);
SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
/* pmlmeext->mgnt_seq++; */
@@ -495,9 +495,9 @@ static void issue_probersp(struct adapter *padapter, unsigned char *da)
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
- memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, da);
+ ether_addr_copy(pwlanhdr->addr2, mac);
+ ether_addr_copy(pwlanhdr->addr3, bssid);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -642,15 +642,15 @@ static int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pss
if (da) {
/* unicast probe request frame */
- memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- memcpy(pwlanhdr->addr3, da, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, da);
+ ether_addr_copy(pwlanhdr->addr3, da);
} else {
/* broadcast probe request frame */
- memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
- memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, bc_addr);
+ ether_addr_copy(pwlanhdr->addr3, bc_addr);
}
- memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr2, mac);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -785,9 +785,11 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta,
if (psta) {/* for AP mode */
#ifdef CONFIG_88EU_AP_MODE
- memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, psta->hwaddr);
+ ether_addr_copy(pwlanhdr->addr2,
+ myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3,
+ myid(&(padapter->eeprompriv)));
/* setting auth algo number */
@@ -825,9 +827,9 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta,
} else {
__le32 le_tmp32;
__le16 le_tmp16;
- memcpy(pwlanhdr->addr1, pnetwork->MacAddress, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, pnetwork->MacAddress);
+ ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
/* setting auth algo number */
val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) ? 1 : 0;/* 0:OPEN System, 1:Shared key */
@@ -921,9 +923,10 @@ static void issue_asocrsp(struct adapter *padapter, unsigned short status,
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
- memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy((void *)GetAddr3Ptr(pwlanhdr), pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr);
+ ether_addr_copy((void *)GetAddr2Ptr(pwlanhdr),
+ myid(&(padapter->eeprompriv)));
+ ether_addr_copy((void *)GetAddr3Ptr(pwlanhdr), pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
@@ -1044,9 +1047,9 @@ static void issue_assocreq(struct adapter *padapter)
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, pnetwork->MacAddress, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, pnetwork->MacAddress);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -1252,9 +1255,9 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned
if (power_mode)
SetPwrMgt(fctrl);
- memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, da);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -1380,9 +1383,9 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16
SetAckpolicy(qc, pattrib->ack_policy);
- memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, da);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -1483,9 +1486,9 @@ static int _issue_deauth(struct adapter *padapter, unsigned char *da, unsigned s
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, da, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, da);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -1601,9 +1604,9 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr,
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, raddr);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -1760,9 +1763,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
- memcpy(pwlanhdr->addr1, cur_network->MacAddress, ETH_ALEN);
- memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
- memcpy(pwlanhdr->addr3, cur_network->MacAddress, ETH_ALEN);
+ ether_addr_copy(pwlanhdr->addr1, cur_network->MacAddress);
+ ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
+ ether_addr_copy(pwlanhdr->addr3, cur_network->MacAddress);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;
@@ -2159,7 +2162,7 @@ static u8 collect_bss_info(struct adapter *padapter,
if (subtype == WIFI_PROBEREQ) {
/* FIXME */
bssid->InfrastructureMode = Ndis802_11Infrastructure;
- memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
+ ether_addr_copy(bssid->MacAddress, GetAddr2Ptr(pframe));
bssid->Privacy = 1;
return _SUCCESS;
}
@@ -2171,10 +2174,10 @@ static u8 collect_bss_info(struct adapter *padapter,
if (val16 & BIT(0)) {
bssid->InfrastructureMode = Ndis802_11Infrastructure;
- memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
+ ether_addr_copy(bssid->MacAddress, GetAddr2Ptr(pframe));
} else {
bssid->InfrastructureMode = Ndis802_11IBSS;
- memcpy(bssid->MacAddress, GetAddr3Ptr(pframe), ETH_ALEN);
+ ether_addr_copy(bssid->MacAddress, GetAddr3Ptr(pframe));
}
if (val16 & BIT(4))
@@ -4395,7 +4398,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
- memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
+ ether_addr_copy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr);
memcpy((unsigned char *)(pdel_sta_evt->rsvd), (unsigned char *)(&reason), 2);
@@ -4448,7 +4451,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
- memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN);
+ ether_addr_copy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr);
padd_sta_evt->cam_id = cam_idx;
DBG_88E("report_add_sta_event: add STA\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet addresses are __aligned(2)
2016-09-16 21:27 [PATCH] staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet addresses are __aligned(2) sayli karnik
@ 2016-09-17 5:44 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-09-17 5:44 UTC (permalink / raw)
To: sayli karnik; +Cc: outreachy-kernel, Greg Kroah-Hartman
On Sat, 17 Sep 2016, sayli karnik wrote:
> This patch fixes the checkpatch warning:
> Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are
> __aligned(2).
You need to provide evidence that the alignment condition is met. YOu can
use the tool pahole for this. Look at other patches people have submitted
on this issue.
julia
>
> Done using coccinelle:
>
> @@
> expression exp1, exp2;
> @@
> - memcpy(exp1, exp2, ETH_ALEN);
> + ether_addr_copy(exp1, exp2);
>
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 89 ++++++++++++++-------------
> 1 file changed, 46 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> index 9544e55..fa8a5ca 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> @@ -353,9 +353,9 @@ static void issue_beacon(struct adapter *padapter, int timeout_ms)
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
>
> - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, cur_network->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, bc_addr);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, cur_network->MacAddress);
>
> SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
> /* pmlmeext->mgnt_seq++; */
> @@ -495,9 +495,9 @@ static void issue_probersp(struct adapter *padapter, unsigned char *da)
>
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
> - memcpy(pwlanhdr->addr1, da, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
> - memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, da);
> + ether_addr_copy(pwlanhdr->addr2, mac);
> + ether_addr_copy(pwlanhdr->addr3, bssid);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -642,15 +642,15 @@ static int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pss
>
> if (da) {
> /* unicast probe request frame */
> - memcpy(pwlanhdr->addr1, da, ETH_ALEN);
> - memcpy(pwlanhdr->addr3, da, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, da);
> + ether_addr_copy(pwlanhdr->addr3, da);
> } else {
> /* broadcast probe request frame */
> - memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
> - memcpy(pwlanhdr->addr3, bc_addr, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, bc_addr);
> + ether_addr_copy(pwlanhdr->addr3, bc_addr);
> }
>
> - memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr2, mac);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -785,9 +785,11 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta,
> if (psta) {/* for AP mode */
> #ifdef CONFIG_88EU_AP_MODE
>
> - memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, psta->hwaddr);
> + ether_addr_copy(pwlanhdr->addr2,
> + myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3,
> + myid(&(padapter->eeprompriv)));
>
>
> /* setting auth algo number */
> @@ -825,9 +827,9 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta,
> } else {
> __le32 le_tmp32;
> __le16 le_tmp16;
> - memcpy(pwlanhdr->addr1, pnetwork->MacAddress, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, pnetwork->MacAddress);
> + ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> /* setting auth algo number */
> val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) ? 1 : 0;/* 0:OPEN System, 1:Shared key */
> @@ -921,9 +923,10 @@ static void issue_asocrsp(struct adapter *padapter, unsigned short status,
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
>
> - memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
> - memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy((void *)GetAddr3Ptr(pwlanhdr), pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr);
> + ether_addr_copy((void *)GetAddr2Ptr(pwlanhdr),
> + myid(&(padapter->eeprompriv)));
> + ether_addr_copy((void *)GetAddr3Ptr(pwlanhdr), pnetwork->MacAddress);
>
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> @@ -1044,9 +1047,9 @@ static void issue_assocreq(struct adapter *padapter)
>
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
> - memcpy(pwlanhdr->addr1, pnetwork->MacAddress, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, pnetwork->MacAddress);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -1252,9 +1255,9 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned
> if (power_mode)
> SetPwrMgt(fctrl);
>
> - memcpy(pwlanhdr->addr1, da, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, da);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -1380,9 +1383,9 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16
>
> SetAckpolicy(qc, pattrib->ack_policy);
>
> - memcpy(pwlanhdr->addr1, da, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, da);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -1483,9 +1486,9 @@ static int _issue_deauth(struct adapter *padapter, unsigned char *da, unsigned s
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
>
> - memcpy(pwlanhdr->addr1, da, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, da);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -1601,9 +1604,9 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr,
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
>
> - memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, pnetwork->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, raddr);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, pnetwork->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -1760,9 +1763,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)
> fctrl = &pwlanhdr->frame_control;
> *(fctrl) = 0;
>
> - memcpy(pwlanhdr->addr1, cur_network->MacAddress, ETH_ALEN);
> - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
> - memcpy(pwlanhdr->addr3, cur_network->MacAddress, ETH_ALEN);
> + ether_addr_copy(pwlanhdr->addr1, cur_network->MacAddress);
> + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
> + ether_addr_copy(pwlanhdr->addr3, cur_network->MacAddress);
>
> SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
> pmlmeext->mgnt_seq++;
> @@ -2159,7 +2162,7 @@ static u8 collect_bss_info(struct adapter *padapter,
> if (subtype == WIFI_PROBEREQ) {
> /* FIXME */
> bssid->InfrastructureMode = Ndis802_11Infrastructure;
> - memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
> + ether_addr_copy(bssid->MacAddress, GetAddr2Ptr(pframe));
> bssid->Privacy = 1;
> return _SUCCESS;
> }
> @@ -2171,10 +2174,10 @@ static u8 collect_bss_info(struct adapter *padapter,
>
> if (val16 & BIT(0)) {
> bssid->InfrastructureMode = Ndis802_11Infrastructure;
> - memcpy(bssid->MacAddress, GetAddr2Ptr(pframe), ETH_ALEN);
> + ether_addr_copy(bssid->MacAddress, GetAddr2Ptr(pframe));
> } else {
> bssid->InfrastructureMode = Ndis802_11IBSS;
> - memcpy(bssid->MacAddress, GetAddr3Ptr(pframe), ETH_ALEN);
> + ether_addr_copy(bssid->MacAddress, GetAddr3Ptr(pframe));
> }
>
> if (val16 & BIT(4))
> @@ -4395,7 +4398,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi
> pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
>
> pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
> - memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
> + ether_addr_copy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr);
> memcpy((unsigned char *)(pdel_sta_evt->rsvd), (unsigned char *)(&reason), 2);
>
>
> @@ -4448,7 +4451,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int
> pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
>
> padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
> - memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN);
> + ether_addr_copy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr);
> padd_sta_evt->cam_id = cam_idx;
>
> DBG_88E("report_add_sta_event: add STA\n");
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160916212749.GA25100%40sayli-HP-15-Notebook-PC.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-17 5:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 21:27 [PATCH] staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet addresses are __aligned(2) sayli karnik
2016-09-17 5:44 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.