From: Eric Dumazet
Similar to the fix provided by Dominik Heidler in commit
9b3dc0a17d73 ("l2tp: cast l2tp traffic counter to unsigned")
we need to take care of 32bit kernels in dev_get_stats().
When using atomic_long_read(), we add a 'long' to u64 and
might misinterpret high order bit, unless we cast to unsigned.
Fixes: caf586e5f23ce ("net: add a core netdev->rx_dropped counter")
Fixes: 015f0688f57ca ("net: net: add a core netdev->tx_dropped counter")
Fixes: 6e7333d315a76 ("net: add rx_nohandler stat counter")
Signed-off-by: Eric Dumazet
Cc: Jarod Wilson
---
Note: I will provide similar other fixes in networking tree.
net/core/dev.c |6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 7243421c9783..91bb55070533 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7783,9 +7783,9 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device
*dev,
} else {
netdev_stats_to_stats64(storage, >stats);
}
- storage->rx_dropped += atomic_long_read(>rx_dropped);
- storage->tx_dropped += atomic_long_read(>tx_dropped);
- storage->rx_nohandler += atomic_long_read(>rx_nohandler);
+ storage->rx_dropped += (unsigned
long)atomic_long_read(>rx_dropped);
+ storage->tx_dropped += (unsigned
long)atomic_long_read(>tx_dropped);
+ storage->rx_nohandler += (unsigned
long)atomic_long_read(>rx_nohandler);
return storage;
}
EXPORT_SYMBOL(dev_get_stats);