All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 11/13] mtd: prevent a read from regions[-1]
@ 2009-09-18 19:51 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2009-09-18 19:51 UTC (permalink / raw)
  To: dwmw2; +Cc: roel.kluin, akpm, linux-mtd

From: Roel Kluin <roel.kluin@gmail.com>

If the erase region was found in the first iteration we read from
regions[-1]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/mtdpart.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/mtd/mtdpart.c~mtd-prevent-a-read-from-regions drivers/mtd/mtdpart.c
--- a/drivers/mtd/mtdpart.c~mtd-prevent-a-read-from-regions
+++ a/drivers/mtd/mtdpart.c
@@ -453,7 +453,8 @@ static struct mtd_part *add_one_partitio
 		for (i = 0; i < max && regions[i].offset <= slave->offset; i++)
 			;
 		/* The loop searched for the region _behind_ the first one */
-		i--;
+		if (i > 0)
+			i--;
 
 		/* Pick biggest erasesize */
 		for (; i < max && regions[i].offset < end; i++) {
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-18 19:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-18 19:51 [patch 11/13] mtd: prevent a read from regions[-1] akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.