1
0
Fork 0

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>
hifive-unleashed-5.1
Sachin Kamat 2012-09-25 15:27:13 +05:30 committed by Artem Bityutskiy
parent 0aa87b7563
commit ecbcbc7b75
1 changed files with 1 additions and 1 deletions

View File

@ -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);