From 17b536cc43bcf2afcc20b4812f93a895881b5f4f Mon Sep 17 00:00:00 2001 From: Atsushi Nemoto Date: Fri, 6 Mar 2009 20:01:08 +0900 Subject: [MTD] mtdpart: Make all partition parsers return allocated array Currently redboot and afx parser return allocated mtd_partition array and cmdlinepart and ar7 return persistent array. This patch make cmdlinepart and ar7 also return allocated array, so that all users can free it regardless of parser type. Signed-off-by: Atsushi Nemoto Signed-off-by: David Woodhouse --- drivers/mtd/cmdlinepart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/mtd/cmdlinepart.c') 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; } } -- cgit v1.2.3