summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/microchip
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-11-18 06:27:19 -0800
committerDavid S. Miller <davem@davemloft.net>2021-11-19 10:46:04 +0000
commitb09d58025e3c6c78a874c234769cc95b9276e94e (patch)
tree7a61bea339cf13cb063c244d5a7cb8a9634ad6b4 /drivers/net/wireless/microchip
parent54612b4a8bc78f4fc62f6c5639c89e4ea5a2ac79 (diff)
wilc1000: copy address before calling wilc_set_mac_address
wilc_set_mac_address() calls IO routines which don't guarantee the pointer won't be written to. Make a copy. Acked-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/microchip')
-rw-r--r--drivers/net/wireless/microchip/wilc1000/netdev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 690572e01a2a..4712cd7dff9f 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -574,6 +574,7 @@ static int wilc_mac_open(struct net_device *ndev)
struct wilc *wl = vif->wilc;
int ret = 0;
struct mgmt_frame_regs mgmt_regs = {};
+ u8 addr[ETH_ALEN] __aligned(2);
if (!wl || !wl->dev) {
netdev_err(ndev, "device not ready\n");
@@ -596,10 +597,9 @@ static int wilc_mac_open(struct net_device *ndev)
vif->idx);
if (is_valid_ether_addr(ndev->dev_addr)) {
- wilc_set_mac_address(vif, ndev->dev_addr);
+ ether_addr_copy(addr, ndev->dev_addr);
+ wilc_set_mac_address(vif, addr);
} else {
- u8 addr[ETH_ALEN];
-
wilc_get_mac_address(vif, addr);
eth_hw_addr_set(ndev, addr);
}