Patchwork [V2] mtd: bcm47xxpart: fix off by one in partitions limit

login
register
mail settings
Submitter Rafał Miłecki
Date Feb. 26, 2014, 1:02 p.m.
Message ID <1393419726-26503-1-git-send-email-zajec5@gmail.com>
Download mbox | patch
Permalink /patch/324383/
State Accepted
Commit 00b79860eb5f72462016046d3841b19ebff6e846
Headers show

Comments

Rafał Miłecki - Feb. 26, 2014, 1:02 p.m.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
V2: Same fix for NVRAM looking code
---
 drivers/mtd/bcm47xxpart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Brian Norris - March 7, 2014, 7:30 a.m.
On Wed, Feb 26, 2014 at 02:02:06PM +0100, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> V2: Same fix for NVRAM looking code

Pushed to l2-mtd.git. Thanks!

Brian

Patch

diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index de1eb92..e388e69 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;
 		}