mtd: prevent a read from regions[-1]
PATCH 11/13 mtd: prevent a read from regions[-1]
From: Roel Kluin <[email protected]>
If the erase region was found in the first iteration we read from regions[-1]
Signed-off-by Roel Kluin <[email protected]>
Cc David Woodhouse <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/mtd/mtdpart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/mtdpart.c renamed from drivers/mtd/mtdpart.c~mtd-prevent-a-read-from-regions +2 -1
@@ -453,7 +453,8 @@ static struct mtd_part *add_one_partitiofor (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++) {
_