提交 ecbcbc7b 编写于 作者: S Sachin Kamat 提交者: Artem Bityutskiy

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: NSachin Kamat <sachin.kamat@linaro.org>
Cc: stable@vger.kernel.org [3.2+]
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
上级 0aa87b75
...@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master, ...@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
nr_parts = plen / sizeof(part[0]); nr_parts = plen / sizeof(part[0]);
*pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL); *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
if (!pparts) if (!*pparts)
return -ENOMEM; return -ENOMEM;
names = of_get_property(dp, "partition-names", &plen); names = of_get_property(dp, "partition-names", &plen);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册