[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1186218982.26902.47.camel@sauron>
Date: Sat, 04 Aug 2007 12:16:22 +0300
From: Artem Bityutskiy <dedekind@...radead.org>
To: Jesper Juhl <jesper.juhl@...il.com>
Cc: linux-mtd@...ts.infradead.org,
David Woodhouse <dwmw2@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] UBI: Don't use signed int as array index before
testing if it is negative
On Sat, 2007-08-04 at 01:25 +0200, Jesper Juhl wrote:
> Hi,
>
> I can't find anything guaranteeing that 'ubi_num' cannot be <0 in
> drivers/mtd/ubi/kapi.c::ubi_open_volume(), and in fact the code
> even tests for that and errors out if so. Unfortunately the test
> for "ubi_num < 0" happens after we've already used 'ubi_num' as
> an array index - bad thing to do if it is negative.
> This patch moves the test earlier in the function and then moves
> the indexing using that variable after the check. A bit safer :-)
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
Thanks for the catch, committed to UBI git tree.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
-
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