[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121130185120.536050880@linuxfoundation.org>
Date: Fri, 30 Nov 2012 10:55:14 -0800
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
alan@...rguk.ukuu.org.uk, Sachin Kamat <sachin.kamat@...aro.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
Artem Bityutskiy <artem.bityutskiy@...el.com>,
David Woodhouse <David.Woodhouse@...el.com>
Subject: [ 22/56] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Kamat <sachin.kamat@...aro.org>
commit 5a6ea4af0907f995dc06df21a9c9ef764c7cd3bc upstream.
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@...aro.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
Cc: Artem Bityutskiy <artem.bityutskiy@...el.com>
Signed-off-by: David Woodhouse <David.Woodhouse@...el.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/mtd/ofpart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(st
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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists