summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamax Lo <ramaxlo@gmail.com>2010-01-14 03:15:05 +0100
committerBen Dooks <ben-linux@fluff.org>2010-01-14 03:25:44 +0100
commit9b96918a974fcd6c9e752cc8b28157f776c601d3 (patch)
tree7aaf19ea7af8a9dc1cc79425934fd56bdf87ccfb
parentMerge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/air... (diff)
downloadlinux-9b96918a974fcd6c9e752cc8b28157f776c601d3.tar.xz
linux-9b96918a974fcd6c9e752cc8b28157f776c601d3.zip
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: Ramax Lo <ramaxlo@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r--arch/arm/plat-s3c/dev-nand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
index 84808ccda70e..a52fb6cf618f 100644
--- a/arch/arm/plat-s3c/dev-nand.c
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -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;