[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080822194428.GB31789@1wt.eu>
Date: Fri, 22 Aug 2008 21:44:28 +0200
From: Willy Tarreau <w@....eu>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Constantin Baranov <const@...st.mimas.ru>,
linux-kernel@...r.kernel.org, Richard Purdie <rpurdie@...ys.net>
Subject: Re: [PATCH 2.6.27-rc3] led: driver for LEDs on PCEngines ALIX.2 and ALIX.3 boards
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 <const@...st.mimas.ru> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists