Patchwork [1/2] mtd: cmdlinepart: fix skipping zero sized partition

login
register
mail settings
Submitter Christopher Cordahi
Date Dec. 17, 2012, 12:59 a.m.
Message ID <714bcce84fccef617818f8916475a666f880cbf1.1355438632.git.christophercordahi@nanometrics.ca>
Download mbox | patch
Permalink /patch/206758/
State New
Headers show

Comments

Christopher Cordahi - Dec. 17, 2012, 12:59 a.m.
Decrement index i after skipping a zero sized partition.  On next loop
iteration, the index will be the same as before, but the data will be
new as it was moved when earlier partition was skipped.

Signed-off-by: Christopher Cordahi <christophercordahi@nanometrics.ca>
---
 drivers/mtd/cmdlinepart.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Shmulik Ladkani - Dec. 17, 2012, 6:35 a.m.
Thanks Chris.

On Sun, 16 Dec 2012 19:59:29 -0500 Christopher Cordahi <christophercordahi@nanometrics.ca> wrote:
> Decrement index i after skipping a zero sized partition.  On next loop
> iteration, the index will be the same as before, but the data will be
> new as it was moved when earlier partition was skipped.
> 
> Signed-off-by: Christopher Cordahi <christophercordahi@nanometrics.ca>

Acked-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>

Patch

diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index c533f27..c1efb4c 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -337,6 +337,7 @@  static int parse_cmdline_partitions(struct mtd_info *master,
 			part->num_parts--;
 			memmove(&part->parts[i], &part->parts[i + 1],
 				sizeof(*part->parts) * (part->num_parts - i));
+			i--;
 			continue;
 		}