Skip to content

Commit

Permalink
ARM: S3C: NAND: Check the existence of nr_map before copying
Browse files Browse the repository at this point in the history
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: Ramax Lo <ramaxlo@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Ramax Lo authored and Ben Dooks committed Jan 14, 2010
1 parent 004b350 commit 9b96918
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm/plat-s3c/dev-nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
return -ENOMEM;
}

size = sizeof(int) * set->nr_chips;
if (size) {
if (set->nr_map && set->nr_chips) {
size = sizeof(int) * set->nr_chips;
ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
set->nr_map = ptr;

Expand Down

0 comments on commit 9b96918

Please sign in to comment.