Skip to contentSkip to conversation

Staging: rtl8712: Replace memcpy with ether_addr_copy

PATCH In review Vatika Harlalka 2 participants 2 messages Mar 14, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8712: Replace memcpy with ether_addr_copy

Replace

Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN)

---
 drivers/staging/rtl8712/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/os_intfs.c +1 -1
index ebfb29e..e1b54fb 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
1.9.1
#1 lore raw
Quoted 3 lines · Vatika Harlalka

Replace

Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN)

Something went wrong with the commit message.

Also eth_addr_copy requires alignment (Please note: dst & src must both be aligned to u16). You need to justify why this property holds.

julia

Quoted 28 lines
---
 drivers/staging/rtl8712/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/os_intfs.c +1 -2
index ebfb29e..e1b54fb 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;
 }
 
--

1.9.1

--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150314111518.GA12847%40akanksha.
For more options, visit https://groups.google.com/d/optout.