From: Rafał Miłecki Date: Wed, 26 Feb 2014 13:02:06 +0000 (+0100) Subject: mtd: bcm47xxpart: fix off by one in partitions limit X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=00b79860eb5f72462016046d3841b19ebff6e846;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mtd: bcm47xxpart: fix off by one in partitions limit Signed-off-by: Rafał Miłecki Signed-off-by: Brian Norris --- diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index de1eb92e42f5..e388e69d853e 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c @@ -91,7 +91,7 @@ static int bcm47xxpart_parse(struct mtd_info *master, if (offset >= 0x2000000) break; - if (curr_part > BCM47XXPART_MAX_PARTS) { + if (curr_part >= BCM47XXPART_MAX_PARTS) { pr_warn("Reached maximum number of partitions, scanning stopped!\n"); break; } @@ -212,7 +212,7 @@ static int bcm47xxpart_parse(struct mtd_info *master, /* Look for NVRAM at the end of the last block. */ for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) { - if (curr_part > BCM47XXPART_MAX_PARTS) { + if (curr_part >= BCM47XXPART_MAX_PARTS) { pr_warn("Reached maximum number of partitions, scanning stopped!\n"); break; }