[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACVxJT90bUVFFZkCS1uxRLbptGFRUDYdtoXiXg8xufeucSsa=g@mail.gmail.com>
Date: Wed, 23 Nov 2016 18:35:43 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: fix bogus cast in skb_pagelen() and use unsigned variables
On Wed, Nov 23, 2016 at 3:49 PM, David Laight <David.Laight@...lab.com> wrote:
> From: Alexey Dobriyan
>> Sent: 19 November 2016 01:08
> ...
>> - for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--)
>> + for (i = skb_shinfo(skb)->nr_frags - 1; (int)i >= 0; i--)
>> len += skb_frag_size(&skb_shinfo(skb)->frags[i]);
>
> Think I'd use:
> for (i = skb_shinfo(skb)->nr_frags; i-- != 0; )
This kind of diverges from canonical loop form:
for (init; temination condition: iterator)
by shifting everything into termination part.
A
Powered by blists - more mailing lists