summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/cmdlinepart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/cmdlinepart.c')
-rw-r--r--drivers/mtd/cmdlinepart.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index 50a340388e74..5011fa73f918 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -335,7 +335,11 @@ static int parse_cmdline_partitions(struct mtd_info *master,
}
offset += part->parts[i].size;
}
- *pparts = part->parts;
+ *pparts = kmemdup(part->parts,
+ sizeof(*part->parts) * part->num_parts,
+ GFP_KERNEL);
+ if (!*pparts)
+ return -ENOMEM;
return part->num_parts;
}
}