OSDN Git Service

cdc_ncm: Fix tx_bytes statistics
authorBjørn Mork <bjorn@mork.no>
Fri, 22 May 2015 11:15:22 +0000 (13:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jun 2015 00:03:21 +0000 (17:03 -0700)
commitd9873ba9a6b370017cc29eac8410e8ea419278f6
treee6fb7dd90696b4e1c09ecfb44d2fd8458eb8a9eb
parentc8e8247cb34640b145798c09d09b5eaa9502180c
cdc_ncm: Fix tx_bytes statistics

[ Upstream commit 44f6731d8b68fa02f5ed65eaceac41f8c3c9279e ]

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: 7a1e890e2168 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/cdc_ncm.c