[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+v06zKLoMEP-cVzhZsm8mEs+q2eWeSDMCgQ9Q=OSznDQ@mail.gmail.com>
Date: Fri, 10 Feb 2023 16:13:21 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Felix Riemann <felix.riemann@....de>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] net: Fix unwanted sign extension in netdev_stats_to_stats64()
On Fri, Feb 10, 2023 at 1:37 PM Felix Riemann <svc.sw.rte.linux@....de> wrote:
>
> From: Felix Riemann <felix.riemann@....de>
>
> When converting net_device_stats to rtnl_link_stats64 sign extension
> is triggered on ILP32 machines as 6c1c509778 changed the previous
> "ulong -> u64" conversion to "long -> u64" by accessing the
> net_device_stats fields through a (signed) atomic_long_t.
>
> This causes for example the received bytes counter to jump to 16EiB after
> having received 2^31 bytes. Casting the atomic value to "unsigned long"
> beforehand converting it into u64 avoids this.
>
> Fixes: 6c1c5097781f ("net: add atomic_long_t to net_device_stats fields")
> Signed-off-by: Felix Riemann <felix.riemann@....de>
> ---
Thanks for the fix.
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists