From patchwork Wed Jan 26 00:37:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12724408 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F2AEC5DF62 for ; Wed, 26 Jan 2022 00:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y7KeRz2tTks7gOUxx3lbFYodLgNghu9GqOCg0evapoQ=; b=NYE/80lzfKHpLb vuxTUYdUoRjaibOb/Z/hGwF7ShItYcDmLHD1CLB95CBScAUmsdF4RU/AMmFv7c2OtkTCWCwAMqy+P LTL2Hsi8fTk0wOKoD8SKBXPJjIgX03dSu5MY+JwJ4aMFxyofSieNtSqiMRMmtE+Zls5NgAEXiCSF7 Rv2pzkCGSebmimU2o3nA6vSC47IJdMRNBmxVqU0920ePUJyKyhR9G/DIGKIHYWmqorSuyvFpG0rFU nG798HcOTeS38fct7z1gruS/B/MQqsLx1RXQ8z1fQ1WuHlyVSErksjOxvBnETeyzYqBHDQ8wYaTNZ tlTLlVARqXZPZudhUH5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCWKx-009k8I-Sd; Wed, 26 Jan 2022 00:39:00 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCWK8-009ju1-6l for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 00:38:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9170B81B98; Wed, 26 Jan 2022 00:38:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 585A8C340EB; Wed, 26 Jan 2022 00:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643157485; bh=X4yd7Dxmu5PFhFcieA8ox30wK4paNfYa0lKukRAMuz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oF00jcGG9O2JgCAACElzEdRtFg5cf9j5vTLHU8Ah/RaHgr6oPzA7JzxxZk/lR1hpj 8NQAhKIYgsC5o3t5soLWm+9YJkcK/ii4U6mHdkPHmAqQlf/wT+G7DXJun0GsPN4ozq ZTDl4ePzH5CCx9Isv7uFvmXrsyXVMB5/MhAzu+9dAXnbs2aFi/z7LkQ2nez3zuoa6W Lwyc/mou2FFqoMsk1wemPRVLlHbVgd0YN9lbqsLEfhEnZpDhKmvbEMPTjPmnjBH0xc 9z0TK53dUrFC+1CRU/nL+Dq8oki66vwzZJENv593auxBLa/HRsDkQCqscZ475GQ89x CpqeuXUVwFRUw== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, dave@thedillows.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Jakub Kicinski Subject: [PATCH net v2 1/6] ethernet: 3com/typhoon: don't write directly to netdev->dev_addr Date: Tue, 25 Jan 2022 16:37:56 -0800 Message-Id: <20220126003801.1736586-2-kuba@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220126003801.1736586-1-kuba@kernel.org> References: <20220126003801.1736586-1-kuba@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_163808_409178_BBB94094 X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This driver casts off the const and writes directly to netdev->dev_addr. This will result in a MAC address tree corruption and a warning. Compile tested ppc6xx_defconfig. Fixes: adeef3e32146 ("net: constify netdev->dev_addr") Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/3com/typhoon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c index 481f1df3106c..8aec5d9fbfef 100644 --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c @@ -2278,6 +2278,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) struct net_device *dev; struct typhoon *tp; int card_id = (int) ent->driver_data; + u8 addr[ETH_ALEN] __aligned(4); void __iomem *ioaddr; void *shared; dma_addr_t shared_dma; @@ -2409,8 +2410,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) goto error_out_reset; } - *(__be16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1)); - *(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); + *(__be16 *)&addr[0] = htons(le16_to_cpu(xp_resp[0].parm1)); + *(__be32 *)&addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); + eth_hw_addr_set(dev, addr); if (!is_valid_ether_addr(dev->dev_addr)) { err_msg = "Could not obtain valid ethernet address, aborting";