* [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions
@ 2012-12-17 0:59 Christopher Cordahi
2012-12-17 0:59 ` [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition Christopher Cordahi
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Christopher Cordahi @ 2012-12-17 0:59 UTC (permalink / raw)
To: David Woodhouse
Cc: Artem Bityutskiy, Linux MTD mailing list, Shmulik Ladkani,
Christopher Cordahi
Removing zero sized partitions was introduced in commit
7baf04261062826ea225ab23e07c541e279143fa.
http://permalink.gmane.org/gmane.linux.drivers.mtd/43507
These changes fix a minor error and make the handling more consistent.
Christopher Cordahi (2):
mtd: cmdlinepart: fix skipping zero sized partition
mtd: cmdlinepart: skip partitions truncated to zero
drivers/mtd/cmdlinepart.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition 2012-12-17 0:59 [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Christopher Cordahi @ 2012-12-17 0:59 ` Christopher Cordahi 2012-12-17 6:35 ` Shmulik Ladkani 2012-12-17 0:59 ` [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero Christopher Cordahi 2013-01-15 11:48 ` [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Artem Bityutskiy 2 siblings, 1 reply; 6+ messages in thread From: Christopher Cordahi @ 2012-12-17 0:59 UTC (permalink / raw) To: David Woodhouse Cc: Artem Bityutskiy, Linux MTD mailing list, Shmulik Ladkani, Christopher Cordahi 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(-) 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; } -- 1.7.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition 2012-12-17 0:59 ` [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition Christopher Cordahi @ 2012-12-17 6:35 ` Shmulik Ladkani 0 siblings, 0 replies; 6+ messages in thread From: Shmulik Ladkani @ 2012-12-17 6:35 UTC (permalink / raw) To: Christopher Cordahi Cc: Artem Bityutskiy, Linux MTD mailing list, David Woodhouse 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> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero 2012-12-17 0:59 [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Christopher Cordahi 2012-12-17 0:59 ` [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition Christopher Cordahi @ 2012-12-17 0:59 ` Christopher Cordahi 2012-12-17 7:07 ` Shmulik Ladkani 2013-01-15 11:48 ` [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Artem Bityutskiy 2 siblings, 1 reply; 6+ messages in thread From: Christopher Cordahi @ 2012-12-17 0:59 UTC (permalink / raw) To: David Woodhouse Cc: Artem Bityutskiy, Linux MTD mailing list, Shmulik Ladkani, Christopher Cordahi Perform flash size truncation before skipping zero sized partition so that if the result is a zero sized, it will be skipped like the others. Signed-off-by: Christopher Cordahi <christophercordahi@nanometrics.ca> --- drivers/mtd/cmdlinepart.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c index c1efb4c..525c579 100644 --- a/drivers/mtd/cmdlinepart.c +++ b/drivers/mtd/cmdlinepart.c @@ -330,6 +330,14 @@ static int parse_cmdline_partitions(struct mtd_info *master, if (part->parts[i].size == SIZE_REMAINING) part->parts[i].size = master->size - offset; + if (offset + part->parts[i].size > master->size) { + printk(KERN_WARNING ERRP + "%s: partitioning exceeds flash size, truncating\n", + part->mtd_id); + part->parts[i].size = master->size - offset; + } + offset += part->parts[i].size; + if (part->parts[i].size == 0) { printk(KERN_WARNING ERRP "%s: skipping zero sized partition\n", @@ -338,16 +346,7 @@ static int parse_cmdline_partitions(struct mtd_info *master, memmove(&part->parts[i], &part->parts[i + 1], sizeof(*part->parts) * (part->num_parts - i)); i--; - continue; } - - if (offset + part->parts[i].size > master->size) { - printk(KERN_WARNING ERRP - "%s: partitioning exceeds flash size, truncating\n", - part->mtd_id); - part->parts[i].size = master->size - offset; - } - offset += part->parts[i].size; } *pparts = kmemdup(part->parts, sizeof(*part->parts) * part->num_parts, -- 1.7.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero 2012-12-17 0:59 ` [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero Christopher Cordahi @ 2012-12-17 7:07 ` Shmulik Ladkani 0 siblings, 0 replies; 6+ messages in thread From: Shmulik Ladkani @ 2012-12-17 7:07 UTC (permalink / raw) To: Christopher Cordahi Cc: Artem Bityutskiy, Linux MTD mailing list, David Woodhouse Thanks Chris, On Sun, 16 Dec 2012 19:59:30 -0500 Christopher Cordahi <christophercordahi@nanometrics.ca> wrote: > Perform flash size truncation before skipping zero sized partition > so that if the result is a zero sized, it will be skipped like the > others. > > Signed-off-by: Christopher Cordahi <christophercordahi@nanometrics.ca> Acked-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> > @@ -330,6 +330,14 @@ static int parse_cmdline_partitions(struct mtd_info *master, > if (part->parts[i].size == SIZE_REMAINING) > part->parts[i].size = master->size - offset; > > + if (offset + part->parts[i].size > master->size) { > + printk(KERN_WARNING ERRP > + "%s: partitioning exceeds flash size, truncating\n", > + part->mtd_id); > + part->parts[i].size = master->size - offset; > + } > + offset += part->parts[i].size; > + > if (part->parts[i].size == 0) { > printk(KERN_WARNING ERRP > "%s: skipping zero sized partition\n", > @@ -338,16 +346,7 @@ static int parse_cmdline_partitions(struct mtd_info *master, > memmove(&part->parts[i], &part->parts[i + 1], > sizeof(*part->parts) * (part->num_parts - i)); > i--; > - continue; > } Taking another look (this relates to your prev patch as well), maybe it would be cleaner to avoid the "i--" by converting this 'for' loop to a 'while' loop, executing the "i++" at the end of the loop, keeping the explicit 'continue' in the 'size == 0' case. Regards, Shmulik ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions 2012-12-17 0:59 [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Christopher Cordahi 2012-12-17 0:59 ` [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition Christopher Cordahi 2012-12-17 0:59 ` [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero Christopher Cordahi @ 2013-01-15 11:48 ` Artem Bityutskiy 2 siblings, 0 replies; 6+ messages in thread From: Artem Bityutskiy @ 2013-01-15 11:48 UTC (permalink / raw) To: Christopher Cordahi Cc: Linux MTD mailing list, David Woodhouse, Shmulik Ladkani [-- Attachment #1: Type: text/plain, Size: 379 bytes --] On Sun, 2012-12-16 at 19:59 -0500, Christopher Cordahi wrote: > Removing zero sized partitions was introduced in commit > 7baf04261062826ea225ab23e07c541e279143fa. > http://permalink.gmane.org/gmane.linux.drivers.mtd/43507 > These changes fix a minor error and make the handling more consistent. Pushed both to l2-mtd.git, thanks! -- Best Regards, Artem Bityutskiy [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-15 11:46 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-17 0:59 [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Christopher Cordahi 2012-12-17 0:59 ` [PATCH 1/2] mtd: cmdlinepart: fix skipping zero sized partition Christopher Cordahi 2012-12-17 6:35 ` Shmulik Ladkani 2012-12-17 0:59 ` [PATCH 2/2] mtd: cmdlinepart: skip partitions truncated to zero Christopher Cordahi 2012-12-17 7:07 ` Shmulik Ladkani 2013-01-15 11:48 ` [PATCH 0/2] mtd: cmdlinepart: minor fixes handling zero sized partitions Artem Bityutskiy
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.