Commit 9b96918a authored by Ramax Lo's avatar Ramax Lo Committed by Ben Dooks

ARM: S3C: NAND: Check the existence of nr_map before copying

Since the structure field nr_map is optional, we need to check whether the
chip number map is provided to avoid unexpected NULL pointer exception.
Signed-off-by: default avatarRamax Lo <ramaxlo@gmail.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 004b3506
...@@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set) ...@@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
return -ENOMEM; return -ENOMEM;
} }
size = sizeof(int) * set->nr_chips; if (set->nr_map && set->nr_chips) {
if (size) { size = sizeof(int) * set->nr_chips;
ptr = kmemdup(set->nr_map, size, GFP_KERNEL); ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
set->nr_map = ptr; set->nr_map = ptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment