Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 01D9440F731; Wed, 30 Sep 2026 19:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790796855; cv=none; b=L5XyZuxs7pTQuU/Fv8VULVi/E76tTPJF1bFg7ZwcKwWOJ356MFANtU/2ruohXTi0l69Y8oxP96u2+pRzzWqevWEzG5JvHKKjvfXJ//9bpU4nAgUKJMv9F9fcFdyGhyaXJx6tArUHvzicdxXkcRHTv4YX99zL/Zpg1kELDRL1gH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790796855; c=relaxed/simple; bh=Mm5GPgmrzO6e/BPmEqb6Rcjf+AFbAHQqW9k+A5a2QBY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LJ2dhx+9VE+P+Ml/Cg/B3VE/QXRqLwcY0IV5Rk1YXvey32Tt4rtcy9EjzlxtjdtrfCpkKOOBCx2kCCuafo/H1J3HSL8AhiDxjIIJvoQwWdIu924j74uM5DqvkEyjtucr6OMkJZemSYL+HPCKf1dAyP2SYLLI+WzpciZfGkpurvg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IQEAvUO7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IQEAvUO7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BD6F1F000FF; Wed, 30 Sep 2026 19:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790796853; bh=O+RWO0o+NbS1/XsbrWQCdz090yzkRTWng2SmsP98hGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IQEAvUO7g+7AktKssfpUEAtdDTZCRXbIywib9xKnR+AZIASGJky4YzLb0/nwpY9R1 jjkaTU9XpH4OAv0NgdhQktXb0CaEIZpUmN+V/yFldNVydK0pk3m3jJql2AU3PXyUxp ZboA8eVfey2er6WxfG5jJxf708liP0IS+BMhbgow= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nicolai Buchwitz , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 1061/1193] net: bcmgenet: fix 64-bit RTNL stats reading in ethtool on 32-bit systems Date: Wed, 30 Sep 2026 17:29:05 +0200 Message-ID: <20260930152457.799105306@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152434.301151190@linuxfoundation.org> References: <20260930152434.301151190@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-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit 0e2bec77ea62895416600c90588f593516572bca ] When bcmgenet was converted to 64-bit statistics, STAT_RTNL members were switched to point into struct rtnl_link_stats64, whose fields are 64-bit (__u64) regardless of architecture. However, bcmgenet_get_ethtool_stats() retained a legacy check: if (sizeof(unsigned long) != sizeof(u32) && s->stat_sizeof == sizeof(unsigned long)) On 32-bit systems, sizeof(unsigned long) == sizeof(u32), causing this condition to evaluate to false. As a result, 64-bit RTNL stats fields were read via *(u32 *)p. On 32-bit Big-Endian systems (such as MIPS BE), this reads the high 32 bits and returns 0 until the counter exceeds 4GB; on 32-bit Little-Endian systems (such as 32-bit ARM), the value is truncated to 32 bits. Fix this by checking if s->stat_sizeof == sizeof(u64) so 64-bit fields are always read as 64-bit values. Fixes: 59aa6e3072aa ("net: bcmgenet: switch to use 64bit statistics") Reviewed-by: Nicolai Buchwitz Signed-off-by: Florian Fainelli Link: https://patch.msgid.link/20260921220021.281418-2-florian.fainelli@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 482f56aed980d..61fe19b8f890d 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -1289,9 +1289,8 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, p = (char *)&stats64; p += s->stat_offset; - if (sizeof(unsigned long) != sizeof(u32) && - s->stat_sizeof == sizeof(unsigned long)) - data[i] = *(unsigned long *)p; + if (s->stat_sizeof == sizeof(u64)) + data[i] = *(u64 *)p; else data[i] = *(u32 *)p; } -- 2.53.0