[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241007172715.649822ba@kernel.org>
Date: Mon, 7 Oct 2024 17:27:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Rand Deeb <rand.sec96@...il.com>
Cc: Chris Snook <chris.snook@...il.com>, "David S . Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Christian Marangi <ansuelsmth@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
deeb.rand@...fident.ru, lvc-project@...uxtesting.org,
voskresenski.stanislav@...fident.ru
Subject: Re: [PATCH] drivers:atlx: Prevent integer overflow in statistics
aggregation
On Mon, 7 Oct 2024 12:29:36 +0300 Rand Deeb wrote:
> The `atl1_inc_smb` function aggregates various RX and TX error counters
> from the `stats_msg_block` structure. Currently, the arithmetic operations
> are performed using `u32` types, which can lead to integer overflow when
> summing large values. This overflow occurs before the result is cast to
> a `u64`, potentially resulting in inaccurate network statistics.
>
> To mitigate this risk, each operand in the summation is explicitly cast to
> `u64` before performing the addition. This ensures that the arithmetic is
> executed in 64-bit space, preventing overflow and maintaining accurate
> statistics regardless of the system architecture.
Thanks for the nice commit message, but honestly I don't think
the error counters can overflow u32 on an ancient NIC like this.
--
pw-bot: reject
Powered by blists - more mailing lists