Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752921AbcC0Vk3 (ORCPT ); Sun, 27 Mar 2016 17:40:29 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:38091 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbcC0Vk1 (ORCPT ); Sun, 27 Mar 2016 17:40:27 -0400 From: Rasmus Villemoes To: Francois Romieu Cc: David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: sxgbe: fix error paths in sxgbe_platform_probe() Organization: D03 References: <877fgue1mx.fsf@rasmusvillemoes.dk> <1459027449-2667-1-git-send-email-linux@rasmusvillemoes.dk> <20160327082254.GA10620@electric-eye.fr.zoreil.com> X-Hashcash: 1:20:160327:linux-kernel@vger.kernel.org::QnEHToB3TAqmtQG7:0000000000000000000000000000000002/JL X-Hashcash: 1:20:160327:netdev@vger.kernel.org::V2cLNwDa/asvWFJP:0000000000000000000000000000000000000002vyE X-Hashcash: 1:20:160327:davem@davemloft.net::aHEP2DMb2hnMtfwa:0000000000000000000000000000000000000000004fJo X-Hashcash: 1:20:160327:romieu@fr.zoreil.com::UMHLoMLBTAIi48v9:000000000000000000000000000000000000000008du/ Date: Sun, 27 Mar 2016 23:40:24 +0200 In-Reply-To: <20160327082254.GA10620@electric-eye.fr.zoreil.com> (Francois Romieu's message of "Sun, 27 Mar 2016 10:22:54 +0200") Message-ID: <87r3ev8urb.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 Content-Length: 995 Lines: 34 On Sun, Mar 27 2016, Francois Romieu wrote: > Rasmus Villemoes : >> 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 > > (ok, i is signed) > > Reviewed-by: Francois Romieu > 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