Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a57ca046 authored by Roel Kluin's avatar Roel Kluin Committed by David Woodhouse
Browse files

mtd: mtdpart: prevent a read from regions[-1]



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

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent ebf2e930
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -453,6 +453,7 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
		for (i = 0; i < max && regions[i].offset <= slave->offset; i++)
			;
		/* The loop searched for the region _behind_ the first one */
		if (i > 0)
			i--;

		/* Pick biggest erasesize */