]> git.baikalelectronics.ru Git - kernel.git/commit
cdc_ncm: Fix tx_bytes statistics
authorBjørn Mork <bjorn@mork.no>
Fri, 22 May 2015 11:15:22 +0000 (13:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 May 2015 18:26:31 +0000 (14:26 -0400)
commit88e536c92585cd682f689c4fd1b1bae6f4f2b211
tree56c9360d6cae85fc174784af990aebb010ee45e6
parent3de5bf6cee0c27f4e93c67f5ec659dc131affba6
cdc_ncm: Fix tx_bytes statistics

The tx_curr_frame_payload field is u32. When we try to calculate a
small negative delta based on it, we end up with a positive integer
close to 2^32 instead.  So the tx_bytes pointer increases by about
2^32 for every transmitted frame.

Fix by calculating the delta as a signed long.

Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Reported-by: Florian Bruhin <me@the-compiler.org>
Fixes: 77b1be3cb169 ("usbnet: Fix tx_bytes statistic running backward in cdc_ncm")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c