Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac802154: use dev_addr_set() - manual

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Kicinski and committed by
David S. Miller
08bb7516 659f4e02

+9 -8
+1 -1
net/ieee802154/6lowpan/core.c
··· 157 157 158 158 lowpan_802154_dev(ldev)->wdev = wdev; 159 159 /* Set the lowpan hardware address to the wpan hardware address. */ 160 - memcpy(ldev->dev_addr, wdev->dev_addr, IEEE802154_ADDR_LEN); 160 + __dev_addr_set(ldev, wdev->dev_addr, IEEE802154_ADDR_LEN); 161 161 /* We need headroom for possible wpan_dev_hard_header call and tailroom 162 162 * for encryption/fcs handling. The lowpan interface will replace 163 163 * the IPv6 header with 6LoWPAN header. At worst case the 6LoWPAN
+8 -7
net/mac802154/iface.c
··· 136 136 * wpan mac has been changed 137 137 */ 138 138 if (sdata->wpan_dev.lowpan_dev) 139 - memcpy(sdata->wpan_dev.lowpan_dev->dev_addr, dev->dev_addr, 140 - dev->addr_len); 139 + dev_addr_set(sdata->wpan_dev.lowpan_dev, dev->dev_addr); 141 140 142 141 return mac802154_wpan_update_llsec(dev); 143 142 } ··· 614 615 unsigned char name_assign_type, enum nl802154_iftype type, 615 616 __le64 extended_addr) 616 617 { 618 + u8 addr[IEEE802154_EXTENDED_ADDR_LEN]; 617 619 struct net_device *ndev = NULL; 618 620 struct ieee802154_sub_if_data *sdata = NULL; 619 621 int ret; ··· 638 638 switch (type) { 639 639 case NL802154_IFTYPE_NODE: 640 640 ndev->type = ARPHRD_IEEE802154; 641 - if (ieee802154_is_valid_extended_unicast_addr(extended_addr)) 642 - ieee802154_le64_to_be64(ndev->dev_addr, &extended_addr); 643 - else 644 - memcpy(ndev->dev_addr, ndev->perm_addr, 645 - IEEE802154_EXTENDED_ADDR_LEN); 641 + if (ieee802154_is_valid_extended_unicast_addr(extended_addr)) { 642 + ieee802154_le64_to_be64(addr, &extended_addr); 643 + dev_addr_set(ndev, addr); 644 + } else { 645 + dev_addr_set(ndev, ndev->perm_addr); 646 + } 646 647 break; 647 648 case NL802154_IFTYPE_MONITOR: 648 649 ndev->type = ARPHRD_IEEE802154_MONITOR;