[PATCH] mtd: fix uninitialised mtd map name

Guennadi Liakhovetski g.liakhovetski at gmx.de
Mon Dec 31 03:57:30 EST 2012


A recent commit "mtd: physmap_of: allow to specify the mtd name for retro
compatiblity" introduced a regression: if no linux,mtd-name DT property is
provided, the local mtd_name variable remains uninitialised and usually
it's != NULL, which leads to a random garbage in MTD map name. Fix this by
initialising the variable to NULL.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski at gmx.de>
---

Please, push to 3.8, unless already fixed.

 drivers/mtd/maps/physmap_of.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 37cdc20..6fb2bd8 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -170,7 +170,7 @@ static int of_flash_probe(struct platform_device *dev)
 	resource_size_t res_size;
 	struct mtd_part_parser_data ppdata;
 	bool map_indirect;
-	const char *mtd_name;
+	const char *mtd_name = NULL;
 
 	match = of_match_device(of_flash_match, &dev->dev);
 	if (!match)
-- 
1.7.2.5




More information about the linux-mtd mailing list