From: Ben Hutchings <ben.hutchings@codethink.co.uk>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: netdev@vger.kernel.org, Florian Bruhin <me@the-compiler.org>,
linux-usb@vger.kernel.org, Oliver Neukum <oliver@neukum.org>
Subject: Re: [PATCH net,stable-4.0] cdc_ncm: Fix tx_bytes statistics
Date: Fri, 22 May 2015 18:22:47 +0100 [thread overview]
Message-ID: <1432315367.22824.19.camel@codethink.co.uk> (raw)
In-Reply-To: <1432293322-11928-1-git-send-email-bjorn@mork.no>
On Fri, 2015-05-22 at 13:15 +0200, Bjørn Mork wrote:
> 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.
Told you I hadn't tested it.
Ben.
> 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>
> ---
> drivers/net/usb/cdc_ncm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
> index c3e4da9e79ca..8067b8fbb0ee 100644
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
> * payload data instead.
> */
> usbnet_set_skb_tx_stats(skb_out, n,
> - ctx->tx_curr_frame_payload - skb_out->len);
> + (long)ctx->tx_curr_frame_payload - skb_out->len);
>
> return skb_out;
>
next prev parent reply other threads:[~2015-05-22 17:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 11:15 [PATCH net,stable-4.0] cdc_ncm: Fix tx_bytes statistics Bjørn Mork
2015-05-22 17:22 ` Ben Hutchings [this message]
2015-05-22 18:48 ` Bjørn Mork
[not found] ` <1432293322-11928-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2015-05-22 18:34 ` David Miller
[not found] ` <20150522.143421.442426385899149301.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-05-23 9:27 ` Florian Bruhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432315367.22824.19.camel@codethink.co.uk \
--to=ben.hutchings@codethink.co.uk \
--cc=bjorn@mork.no \
--cc=linux-usb@vger.kernel.org \
--cc=me@the-compiler.org \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).