Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360341
b: refs/heads/master
c: ebf4f07
h: refs/heads/master
i:
  360339: 4839141
v: v3
  • Loading branch information
Christopher Cordahi authored and Artem Bityutskiy committed Feb 4, 2013
1 parent a7a9e72 commit 1d1ac12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e25e0a4de1237972a86e5831c8659c4068ff23f7
refs/heads/master: ebf4f0707df410a7666ec409ee68dc068db56e97
17 changes: 8 additions & 9 deletions trunk/drivers/mtd/cmdlinepart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit 1d1ac12

Please sign in to comment.