Message ID | 20211018235021.1279697-4-kuba@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 8fac27fbc80ecdb22c2dd001e9bb0684eed55c01 |
Delegated to: | Kalle Valo |
Headers | show |
Series | wireless: don't write to netdev->dev_addr directly | expand |
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index 3d782fabbfe6..8290cf881a1b 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c @@ -1296,7 +1296,7 @@ static int atmel_set_mac_address(struct net_device *dev, void *p) { struct sockaddr *addr = p; - memcpy (dev->dev_addr, addr->sa_data, dev->addr_len); + eth_hw_addr_set(dev, addr->sa_data); return atmel_open(dev); } diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c index 097805b55c59..6b735fee7b18 100644 --- a/drivers/net/wireless/zydas/zd1201.c +++ b/drivers/net/wireless/zydas/zd1201.c @@ -857,7 +857,7 @@ static int zd1201_set_mac_address(struct net_device *dev, void *p) addr->sa_data, dev->addr_len, 1); if (err) return err; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); + eth_hw_addr_set(dev, addr->sa_data); return zd1201_mac_reset(zd); }
Convert all WiFi drivers from memcpy(... dev->addr_len) to eth_hw_addr_set(): @@ expression dev, np; @@ - memcpy(dev->dev_addr, np, dev->addr_len) + eth_hw_addr_set(dev, np) Manually checked the netdevs are allocated with alloc_etherdev(), so dev->addr_len must be equal to ETH_ALEN. Signed-off-by: Jakub Kicinski <kuba@kernel.org> --- drivers/net/wireless/atmel/atmel.c | 2 +- drivers/net/wireless/zydas/zd1201.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)