Felix Riemann b17d81b94d net: Fix unwanted sign extension in netdev_stats_to_stats64()
[ Upstream commit 9b55d3f0a69af649c62cbc2633e6d695bb3cc583 ]

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@sma.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-10-10 21:44:59 +02:00
..
2023-06-09 10:24:01 +02:00
2022-04-27 13:39:46 +02:00
2023-10-10 21:44:57 +02:00
2023-08-11 11:45:24 +02:00
2023-06-21 15:39:57 +02:00
2023-03-22 13:27:10 +01:00
2023-09-23 10:48:01 +02:00
2019-12-05 09:21:30 +01:00
2023-05-17 11:13:24 +02:00
2023-09-23 10:48:18 +02:00
2021-06-30 08:48:13 -04:00
2023-06-21 15:39:57 +02:00
2023-06-21 15:39:57 +02:00