[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1432315367.22824.19.camel@codethink.co.uk>
Date: Fri, 22 May 2015 18:22:47 +0100
From: Ben Hutchings <ben.hutchings@...ethink.co.uk>
To: Bjørn Mork <bjorn@...k.no>
Cc: netdev@...r.kernel.org, Florian Bruhin <me@...-compiler.org>,
linux-usb@...r.kernel.org, Oliver Neukum <oliver@...kum.org>
Subject: Re: [PATCH net,stable-4.0] cdc_ncm: Fix tx_bytes statistics
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@...ethink.co.uk>
> Reported-by: Florian Bruhin <me@...-compiler.org>
> Fixes: 7a1e890e2168 ("usbnet: Fix tx_bytes statistic running backward in cdc_ncm")
> Signed-off-by: Bjørn Mork <bjorn@...k.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;
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists