[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r3ev8urb.fsf@rasmusvillemoes.dk>
Date: Sun, 27 Mar 2016 23:40:24 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Francois Romieu <romieu@...zoreil.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: sxgbe: fix error paths in sxgbe_platform_probe()
On Sun, Mar 27 2016, Francois Romieu <romieu@...zoreil.com> wrote:
> Rasmus Villemoes <linux@...musvillemoes.dk> :
>> We need to use post-decrement to ensure that irq_dispose_mapping is
>> also called on priv->rxq[0]->irq_no; moreover, if one of the above for
>> loops failed already at i==0 (so we reach one of these labels with
>> that value of i), we'll enter an essentially infinite loop of
>> out-of-bounds accesses.
>>
>> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
>
> (ok, i is signed)
>
> Reviewed-by: Francois Romieu <romieu@...zoreil.com>
>
Thanks for reviewing, but just FTR I want to point out that it doesn't
matter whether i is signed or not in
while (i--)
However, when i is signed, there's another slightly less popular variant
which is equivalent:
while (--i >= 0)
(a precondition for their equivalence is that i has a non-negative value
before reaching the while statement).
Neither are equivalent to the almost-always broken
while (--i)
Rasmus
Powered by blists - more mailing lists