[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161119.221215.1839854526883011435.davem@davemloft.net>
Date: Sat, 19 Nov 2016 22:12:15 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: adobriyan@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] net: fix bogus cast in skb_pagelen() and use unsigned
variables
From: Alexey Dobriyan <adobriyan@...il.com>
Date: Sat, 19 Nov 2016 04:08:08 +0300
> 1) cast to "int" is unnecessary:
> u8 will be promoted to int before decrementing,
> small positive numbers fit into "int", so their values won't be changed
> during promotion.
>
> Once everything is int including loop counters, signedness doesn't
> matter: 32-bit operations will stay 32-bit operations.
>
> But! Someone tried to make this loop smart by making everything of
> the same type apparently in an attempt to optimise it.
> Do the optimization, just differently.
> Do the cast where it matters. :^)
>
> 2) frag size is unsigned entity and sum of fragments sizes is also
> unsigned.
>
> Make everything unsigned, leave no MOVSX instruction behind.
...
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
Applied to net-next.
Powered by blists - more mailing lists