[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87twlgtosn.fsf@rasmusvillemoes.dk>
Date: Wed, 10 Feb 2016 19:15:20 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Yishai Hadas <yishaih@....mellanox.co.il>
Cc: Yishai Hadas <yishaih@...lanox.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
"jackm\@mellanox.com" <jackm@...lanox.com>,
Majd Dibbiny <majd@...lanox.com>
Subject: Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init()
On Wed, Feb 10 2016, Yishai Hadas <yishaih@....mellanox.co.il> wrote:
>> @@ -2429,7 +2429,7 @@ err_thread:
>> flush_workqueue(priv->mfunc.master.comm_wq);
>> destroy_workqueue(priv->mfunc.master.comm_wq);
>> err_slaves:
>> - while (--i) {
>> + while (i--) {
>
> This fix is wrong as it hits the case that i arrived the last value
> then below code will access to a non valid entry in the array.
>
> The expected fix should be:
> while (--i >= 0)
>
Huh? They're completely equivalent (given that i is necessarily
non-negative before we evaluate the loop condition). I don't really care
either way, but git grep says that 'while (i--)' is 5 times more common
than 'while (--i >= 0)'.
Rasmus
Powered by blists - more mailing lists