Skip to contentSkip to conversation

staging: rtl8712: WARNING prefer ether_addr_copy() over memcpy()

PATCH In review Gamze POLAT 2 participants 2 messages Feb 22, 2015 – Feb 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: WARNING prefer ether_addr_copy() over memcpy()

WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
Pahole showed that the addresses are aligned.

---
 drivers/staging/rtl8712/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/os_intfs.c +1 -1
index 13debb5..6d03f8d 100644
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
 	struct sockaddr *addr = p;
 
 	if (padapter->bup == false)
-		memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+		ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
 	return 0;
 }
 
Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 14 lines · Gamze POLAT

WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
Pahole showed that the addresses are aligned.

---
 drivers/staging/rtl8712/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/os_intfs.c +0 -0
index 13debb5..6d03f8d 100644

drivers/staging/rtl8712/os_intfs.c static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p) · line 186

Quoted 7 lines
drivers/staging/rtl8712/os_intfs.c +1 -1
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
 	struct sockaddr *addr = p;
 
 	if (padapter->bup == false)
-		memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+		ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
 	return 0;
 }

Again, we need a bit more "proof".

thanks,

greg k-h