summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ofpart.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-25 15:27:13 +0530
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-15 15:37:46 +0200
commitecbcbc7b75bb1b7596fca2d588d2f7539dc4e581 (patch)
tree09bd4bbff8702d975a3e4d39a05fd870198a5eb5 /drivers/mtd/ofpart.c
parent0aa87b7563f138149429f35727b975ec25a494a6 (diff)
downloadlinux-ecbcbc7b75bb1b7596fca2d588d2f7539dc4e581.tar.gz
linux-ecbcbc7b75bb1b7596fca2d588d2f7539dc4e581.tar.bz2
linux-ecbcbc7b75bb1b7596fca2d588d2f7539dc4e581.zip
mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
The pointer returned by kzalloc should be tested for NULL to avoid potential NULL pointer dereference later. Incorrect pointer was being tested for NULL. Bug introduced by commit fbcf62a3 (mtd: physmap_of: move parse_obsolete_partitions to become separate parser). This patch fixes this bug. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: stable@vger.kernel.org [3.2+] Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ofpart.c')
-rw-r--r--drivers/mtd/ofpart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 64be8f0848b0..d9127e2ed808 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
nr_parts = plen / sizeof(part[0]);
*pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
- if (!pparts)
+ if (!*pparts)
return -ENOMEM;
names = of_get_property(dp, "partition-names", &plen);