mtd: bcm47xxpart: fix off by one in partitions limit
authorRafał Miłecki <zajec5@gmail.com>
Wed, 26 Feb 2014 13:02:06 +0000 (14:02 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 11 Mar 2014 05:42:29 +0000 (22:42 -0700)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/bcm47xxpart.c

index de1eb92e42f57f15f197c3ba21d1831ab6dac06f..e388e69d853e9a68d5d17ec170a14d07da68583f 100644 (file)
@@ -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;
                }