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 09BF8DDAB; Wed, 3 Dec 2025 15:39:59 +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=1764776400; cv=none; b=THgi3FAGWVHcEAwgZI1A1yWY+HXj9ck6XwfVxKXNTLhSd/9GF+7AfRcQVZUMF6vfZv1Ao5ro1xu+vPCDDFdQy9vYe5rm2PYixQpwkIDPd3WWhAWGsSa4+PScOScY5A1IyKtd6CXMmRATOllQUj0iavpA7IkKE80M+10WvOdl3+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776400; c=relaxed/simple; bh=13NFWCw3oV78KyRsA85oauo33h+2B3IMa8Ec70rS6nU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aS9mwdqE86z3Kl1Osc6X+Q4zysgFR0MAZNyTzCNGVil6YrRBKeKZZdK4ojzIWuOqmDSNkILuW9KriGUamW2Y+95ZRkGwzjhacOsP/ciGelDkPcF/960HAMiEanz0vRFjlUdxf5iJEcwWhEk9ku/yhNIxKEIXi5l6zmlmcZWXfjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Gma6r9iy; 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="Gma6r9iy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74BA6C4CEF5; Wed, 3 Dec 2025 15:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764776399; bh=13NFWCw3oV78KyRsA85oauo33h+2B3IMa8Ec70rS6nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gma6r9iyhfP1kQm8TMfGt9qzUZNGXtsQur/CJHiyyWRBSB3QJwE66I2y0KSazHOuA Sl7bQVmR8yPd3uZD9WHHAaCZpUDZ96u2/uSUnUeFupq0jtC3DTBBCPZIAg5a6WMh+n T/UrXTFhp++OGkiXzp11KM6oU2/dlOw9RAKs7TpY= 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 5.10 138/300] net: macb: avoid dealing with endianness in macb_set_hwaddr() Date: Wed, 3 Dec 2025 16:25:42 +0100 Message-ID: <20251203152405.729791233@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152400.447697997@linuxfoundation.org> References: <20251203152400.447697997@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 5.10-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 2a103be1c9d8a..c407e8d0eb618 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -276,9 +276,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); /* Clear unused address register sets */ -- 2.51.0