From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327AbcBJSP2 (ORCPT ); Wed, 10 Feb 2016 13:15:28 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34383 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752219AbcBJSPX (ORCPT ); Wed, 10 Feb 2016 13:15:23 -0500 From: Rasmus Villemoes To: Yishai Hadas Cc: Yishai Hadas , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, "jackm\@mellanox.com" , Majd Dibbiny Subject: Re: [PATCH 3/5] net/mlx4: fix some error handling in mlx4_multi_func_init() Organization: D03 References: <1455048677-19882-1-git-send-email-linux@rasmusvillemoes.dk> <1455048677-19882-4-git-send-email-linux@rasmusvillemoes.dk> <56BB0577.8000000@dev.mellanox.co.il> X-Hashcash: 1:20:160210:linux-kernel@vger.kernel.org::xBbBuebUSqQ8xuVn:00000000000000000000000000000000009A4 X-Hashcash: 1:20:160210:linux-rdma@vger.kernel.org::ZdnDKU7Kr9ZVSerp:000000000000000000000000000000000000UdH X-Hashcash: 1:20:160210:majd@mellanox.com::ZAV6McaErdW3u9Jc:000000000000000000000000000000000000000000001Vmz X-Hashcash: 1:20:160210:yishaih@dev.mellanox.co.il::q1sVoI7oZ4EGaL+D:000000000000000000000000000000000001pSh X-Hashcash: 1:20:160210:netdev@vger.kernel.org::1s+Cc3F4xwHH8SmE:0000000000000000000000000000000000000001y3W X-Hashcash: 1:20:160210:yishaih@mellanox.com::QAikxT71zWt3WvG5:000000000000000000000000000000000000000004bSE X-Hashcash: 1:20:160210:jackm@mellanox.com::CCmTAdqEVEC7IsPX:00000000000000000000000000000000000000000007brm Date: Wed, 10 Feb 2016 19:15:20 +0100 In-Reply-To: <56BB0577.8000000@dev.mellanox.co.il> (Yishai Hadas's message of "Wed, 10 Feb 2016 11:40:07 +0200") Message-ID: <87twlgtosn.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10 2016, Yishai Hadas 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