Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756584AbYHVTpF (ORCPT ); Fri, 22 Aug 2008 15:45:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751764AbYHVTox (ORCPT ); Fri, 22 Aug 2008 15:44:53 -0400 Received: from 1wt.eu ([62.212.114.60]:1153 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbYHVTox (ORCPT ); Fri, 22 Aug 2008 15:44:53 -0400 Date: Fri, 22 Aug 2008 21:44:28 +0200 From: Willy Tarreau To: Andrew Morton Cc: Constantin Baranov , linux-kernel@vger.kernel.org, Richard Purdie Subject: Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines ALIX.2 and ALIX.3 boards Message-ID: <20080822194428.GB31789@1wt.eu> References: <48AB019D.6080302@const.mimas.ru> <20080822115150.6b3907a4.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080822115150.6b3907a4.akpm@linux-foundation.org> User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 31 Hi Andrew, On Fri, Aug 22, 2008 at 11:51:50AM -0700, Andrew Morton wrote: > On Tue, 19 Aug 2008 22:23:41 +0500 > Constantin Baranov wrote: > > +static int __init alix_led_probe(struct platform_device *pdev) > > +{ > > + int i; > > + int ret = 0; > > + > > + for (i = 0; i < ARRAY_SIZE(alix_leds) && ret >= 0; i++) > > + ret = led_classdev_register(&pdev->dev, &alix_leds[i].cdev); > > + > > + if (ret < 0) { > > + for (i = i - 2; i >= 0; i--) > > this is off-by-one, surely. > > If we get here with i==1, we'll loop 4 billion times. No we will not because i is signed. We'll simply not enter the loop. However, the code looks suspicious and the reasoning behind i-2 isn't quite clear. Willy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/