From: Rasmus Villemoes <linux@rasmusvillemoes•dk>
To: Francois Romieu <romieu@fr•zoreil.com>
Cc: David Miller <davem@davemloft•net>,
netdev@vger•kernel.org, linux-kernel@vger•kernel.org
Subject: Re: [PATCH] net: sxgbe: fix error paths in sxgbe_platform_probe()
Date: Sun, 27 Mar 2016 23:40:24 +0200 [thread overview]
Message-ID: <87r3ev8urb.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <20160327082254.GA10620@electric-eye.fr.zoreil.com> (Francois Romieu's message of "Sun, 27 Mar 2016 10:22:54 +0200")
On Sun, Mar 27 2016, Francois Romieu <romieu@fr•zoreil.com> wrote:
> Rasmus Villemoes <linux@rasmusvillemoes•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@rasmusvillemoes•dk>
>
> (ok, i is signed)
>
> Reviewed-by: Francois Romieu <romieu@fr•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
next prev parent reply other threads:[~2016-03-27 21:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 20:11 [PATCH 0/5] pre-decrement in error paths considered harmful Rasmus Villemoes
2016-02-09 20:11 ` [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Rasmus Villemoes
2016-02-10 9:40 ` Yishai Hadas
2016-02-10 18:15 ` Rasmus Villemoes
2016-02-11 9:29 ` Jack Morgenstein
2016-02-11 10:20 ` Jack Morgenstein
2016-02-11 16:02 ` Doug Ledford
2016-02-09 20:11 ` [PATCH 4/5] net: sxgbe: fix error paths in sxgbe_platform_probe() Rasmus Villemoes
2016-03-08 20:44 ` Rasmus Villemoes
2016-03-22 19:47 ` Rasmus Villemoes
2016-03-26 21:24 ` [PATCH] " Rasmus Villemoes
2016-03-27 8:22 ` Francois Romieu
2016-03-27 21:40 ` Rasmus Villemoes [this message]
2016-03-28 2:39 ` David Miller
2016-03-28 2:40 ` David Miller
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=87r3ev8urb.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes$(echo .)dk \
--cc=davem@davemloft$(echo .)net \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=romieu@fr$(echo .)zoreil.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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