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 F0A8936921D; Wed, 3 Dec 2025 16:30:51 +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=1764779452; cv=none; b=KpPUI8PVlIhV0yVZ2QCAqAJBhL7QxRFDTR52MpLNfLLHwzWWuvvmJfL44kkpbnZnHnPd9mesMU10BQc9JJUfGEmMNT5dxWCxjpDe9Iun8fSAZASi8gnW4q/MGGZ2IVTEZrAxJA+rN/7Um/FWaBJXvbn5WrFUi7HPCwT4rTcfVC4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764779452; c=relaxed/simple; bh=GZlRBCn1GfgFCrKX4dEjEkH2TOufyNYjqD7F48KZQCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EZKZdQZEYOmULT67yRp58fsHE3NyECqRWa6nKjXj/37eQRcLgMfmw3ZTHg9bqbLLHTIhcww0zLAvw5q72R+0cR4RYKIVwX4hCOPWr2xmegxci5sNah3DFXqzDomMJ5f5SspdQSwv9k4FyYf7Cm/oHOOp6oBJC/EYZnHwQf8A0CU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F9a2c988; 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="F9a2c988" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F603C4CEF5; Wed, 3 Dec 2025 16:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764779451; bh=GZlRBCn1GfgFCrKX4dEjEkH2TOufyNYjqD7F48KZQCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9a2c988FIYCnJcQaAf4oaPsPZIqGokPSCVrlEPYKsVefGaEm6MH467KrX747p8a6 kko8Nyfb5X+Ng3xa0nKA96l684JP30P8V0k+4PgnTrx33U07eliOLj+z1lws0kIq29 VuL5Eo0YOfQjaJvHJb94p/rME/sNsy/zmLf+XF90= 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.1 262/568] net: macb: avoid dealing with endianness in macb_set_hwaddr() Date: Wed, 3 Dec 2025 16:24:24 +0100 Message-ID: <20251203152450.314133762@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152440.645416925@linuxfoundation.org> References: <20251203152440.645416925@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.1-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 1ea7c86f75013..a143f8214c088 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -283,9 +283,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