Skip to contentSkip to conversation

staging: prism2sta: Replace memcpy with ether_add_copy

PATCH Superseded Ioana Ciornei 3 participants 3 messages Mar 17, 2015 – Mar 18, 2015 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: prism2sta: Replace memcpy with ether_add_copy

Replace memcpy() with ether_addr_copy() when using __aligned(2) Ethernet addresses.
Changes done using the following coccinelle script:

@@
expression e1, e2;
@@

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

---
 drivers/staging/wlan-ng/prism2sta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +3 -3
index 854571f..09fa76b 100644
@@ -1544,7 +1544,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 	 ** authentication.
 	 */
 
-	memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
+	ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
 	rec.status = P80211ENUM_status_unspec_failure;
 
 	/*
@@ -1657,8 +1657,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 			if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
 				rec.status = P80211ENUM_status_ap_full;
 			} else {
-				memcpy(hw->authlist.addr[hw->authlist.cnt],
-				       rec.address, ETH_ALEN);
+				ether_addr_copy(hw->authlist.addr[hw->authlist.cnt],
+						rec.address);
 				hw->authlist.cnt++;
 				added = 1;
 			}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · Ioana Ciornei

Replace memcpy() with ether_addr_copy() when using __aligned(2) Ethernet addresses.
Changes done using the following coccinelle script:

@@
expression e1, e2;
@@

Quoted 7 lines

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

---
 drivers/staging/wlan-ng/prism2sta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

This looks good to me!

Jes

Quoted 25 lines
drivers/staging/wlan-ng/prism2sta.c +3 -3
index 854571f..09fa76b 100644
@@ -1544,7 +1544,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 	 ** authentication.
 	 */
 
-	memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
+	ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
 	rec.status = P80211ENUM_status_unspec_failure;
 
 	/*
@@ -1657,8 +1657,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 			if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
 				rec.status = P80211ENUM_status_ap_full;
 			} else {
-				memcpy(hw->authlist.addr[hw->authlist.cnt],
-				       rec.address, ETH_ALEN);
+				ether_addr_copy(hw->authlist.addr[hw->authlist.cnt],
+						rec.address);
 				hw->authlist.cnt++;
 				added = 1;
 			}
maintainer
#2 lore raw
In reply to Ioana Ciornei
Quoted 8 lines · Ioana Ciornei

Replace memcpy() with ether_addr_copy() when using __aligned(2) Ethernet addresses.
Changes done using the following coccinelle script:

@@
expression e1, e2;
@@

Quoted 7 lines

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

---
 drivers/staging/wlan-ng/prism2sta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

You need to "prove" that this type of change is acceptable before I can take it, sorry.

thanks,

greg k-h