From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A59D262FEC; Tue, 11 Nov 2025 01:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762824396; cv=none; b=iatzPW63dkytqHhzUWhaIiRry+aApsJsNITgbALd8BrR9/s3527TWHYe+iAv6GNdE+xlOflCJT/fSjQMeOISigtPoEKFRpE/tPimiT+DxwFMk8b5UCNVthebgTpC8jXg8FMIognpfEABsFEqD3XATVLC+pQ0MMtZ7L0q6G2pgGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762824396; c=relaxed/simple; bh=gqPFxCGUpZsfuOV720qvyrZO9jksoBfGQPpWc7M5yYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JlObrY+DRrkXuzp/geMv9ol9j4SiJiUfzm0K+Qt+wg9IHcy/AcqKKsBXlPmVwd67Y8mCET7NIy1VsMf68Xv7qIadylKOl076214GHMMYBoqb8ZCOon/aB3ydUhoZh54ZhKca9Os4XszirzBDUDoGgBdk4EZbnt1lKWGraVNlJpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ahf9tRFS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ahf9tRFS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13FB1C4CEF5; Tue, 11 Nov 2025 01:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762824396; bh=gqPFxCGUpZsfuOV720qvyrZO9jksoBfGQPpWc7M5yYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahf9tRFSdbNGzoC6A3R8iox95QbKRcZco0+Fljc5UrmDgwukTT/0cIqVP/rmGuonC a/prw9embbqK7t0++VRy1oPf8KHxMG6jYCJ0h8FKpvMXsnRORXDl290nEBYuT/GBXb wtIFSKo2jBOtE/Q30LzQTboZer1FaH44n7SmmOWw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sean Anderson , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 435/565] net: macb: avoid dealing with endianness in macb_set_hwaddr() Date: Tue, 11 Nov 2025 09:44:51 +0900 Message-ID: <20251111004536.665704644@linuxfoundation.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251111004526.816196597@linuxfoundation.org> References: <20251111004526.816196597@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Théo Lebrun [ Upstream commit 70a5ce8bc94545ba0fb47b2498bfb12de2132f4d ] bp->dev->dev_addr is of type `unsigned char *`. Casting it to a u32 pointer and dereferencing implies dealing manually with endianness, which is error-prone. Replace by calls to get_unaligned_le32|le16() helpers. This was found using sparse: ⟩ make C=2 drivers/net/ethernet/cadence/macb_main.o warning: incorrect type in assignment (different base types) expected unsigned int [usertype] bottom got restricted __le32 [usertype] warning: incorrect type in assignment (different base types) expected unsigned short [usertype] top got restricted __le16 [usertype] ... Reviewed-by: Sean Anderson Signed-off-by: Théo Lebrun Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250923-macb-fixes-v6-5-772d655cdeb6@bootlin.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f7e8c08d84415..8a53c9538b842 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -281,9 +281,9 @@ static void macb_set_hwaddr(struct macb *bp) u32 bottom; u16 top; - bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr)); + bottom = get_unaligned_le32(bp->dev->dev_addr); macb_or_gem_writel(bp, SA1B, bottom); - top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); + top = get_unaligned_le16(bp->dev->dev_addr + 4); macb_or_gem_writel(bp, SA1T, top); if (gem_has_ptp(bp)) { -- 2.51.0