Skip to contentSkip to conversation

mtd: bcm47xxpart: fix off by one in partitions limit

PATCH Superseded Rafał Miłecki 2 participants 3 messages Feb 26, 2014 – Mar 7, 2014 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: bcm47xxpart: fix off by one in partitions limit

---
 drivers/mtd/bcm47xxpart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/bcm47xxpart.c +1 -1
index de1eb92..88802a8 100644
@@ -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;
 		}
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH v2 1/1 mtd: bcm47xxpart: fix off by one in partitions limit

---
V2: Same fix for NVRAM looking code

---
 drivers/mtd/bcm47xxpart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/bcm47xxpart.c +2 -2
index de1eb92..e388e69 100644
@@ -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;
 		}
Signature · 1 line
1.8.4.5