From patchwork Tue Oct 19 16:28:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12570559 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23953C433F5 for ; Tue, 19 Oct 2021 16:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F28EA6113D for ; Tue, 19 Oct 2021 16:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbhJSQae (ORCPT ); Tue, 19 Oct 2021 12:30:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbhJSQad (ORCPT ); Tue, 19 Oct 2021 12:30:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D289360E76; Tue, 19 Oct 2021 16:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634660900; bh=SLj3u9qQw6idOnVDL7zGHCaBfWPhvEXHe/kZALrxMkg=; h=From:To:Cc:Subject:Date:From; b=mkxXNqITf57GSfcxNogILvRLjki4cK3thM0CMjUm89/mbqwYFSMMGP9hUrOX89lb6 VUoEaahTk0cTWcqBMFbe3A1ioAsw6oa8koPR+ZIz8mFVJaQNa+tASxNgnEtr81UiMV Fx5/Xqn0nS6laEYDBa7NWkbIbZS54hpsfXmUD65uqoRHEBYuJGi/XqNMsW5LnAKY1p RVYz/2Jm/Q72WDuya3fJdw9/spCPpAf6o3Viaxhd8vYWpE//FN0+6OMIGMfWdEfYyT ppTPTP/FagpnL0YG2BWszk1k0/pyr7jiSZaXDPKxajNEJTTxpUmcWrN6wU+oGbhC3P I2FWg4Rv2djDQ== From: Jakub Kicinski To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Jakub Kicinski Subject: [PATCH 1/2] mac80211: use eth_hw_addr_set() Date: Tue, 19 Oct 2021 09:28:15 -0700 Message-Id: <20211019162816.1384077-1-kuba@kernel.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. Convert mac80211 from memcpy(... ETH_ADDR) to eth_hw_addr_set(): @@ expression dev, np; @@ - memcpy(dev->dev_addr, np, ETH_ALEN) + eth_hw_addr_set(dev, np) Signed-off-by: Jakub Kicinski --- net/mac80211/iface.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 62c95597704b..878b919f22bb 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1108,9 +1108,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) * this interface, if it has the special null one. */ if (dev && is_zero_ether_addr(dev->dev_addr)) { - memcpy(dev->dev_addr, - local->hw.wiphy->perm_addr, - ETH_ALEN); + eth_hw_addr_set(dev, local->hw.wiphy->perm_addr); memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); if (!is_valid_ether_addr(dev->dev_addr)) { @@ -1964,9 +1962,9 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ieee80211_assign_perm_addr(local, ndev->perm_addr, type); if (is_valid_ether_addr(params->macaddr)) - memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN); + eth_hw_addr_set(ndev, params->macaddr); else - memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); + eth_hw_addr_set(ndev, ndev->perm_addr); SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); /* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */