Patchwork mtd: fix uninitialised mtd map name

login
register
mail settings
Submitter Guennadi Liakhovetski
Date Dec. 31, 2012, 8:57 a.m.
Message ID <Pine.LNX.4.64.1212310952190.23808@axis700.grange>
Download mbox | patch
Permalink /patch/208821/
State New
Headers show

Comments

Guennadi Liakhovetski - Dec. 31, 2012, 8:57 a.m.
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@gmx.de>
---

Please, push to 3.8, unless already fixed.

 drivers/mtd/maps/physmap_of.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Guennadi Liakhovetski - Feb. 2, 2013, 9:48 p.m.
Hi David

Do I see it right, that this patch didn't make it into the kernel on time 
for 3.8? Could you please, make sure it makes it to 3.9?

Thanks
Guennadi

On Mon, 31 Dec 2012, Guennadi Liakhovetski wrote:

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

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Brian Norris - Feb. 9, 2013, 10:54 p.m.
On Sat, Feb 2, 2013 at 1:48 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Do I see it right, that this patch didn't make it into the kernel on time
> for 3.8? Could you please, make sure it makes it to 3.9?

It looks like an independent but identical patch made it in for 3.8-rc7:

commit 7dfe4be351e81656ca1068e5d4ead235c7ba94b1
Author: Baruch Siach <baruch@tkos.co.il>
Date:   Sun Dec 23 13:10:50 2012 +0200

    mtd: physmap_of: fix cmdline partition method w/o linux, mtd-name

    Commit d68cbdd4fb (mtd: physmap_of: allow to specify the mtd name for retro
    compatiblity) broke cmdline partitioning using dev_name() in the
kernel command
    line.  of_property_read_string() does not touch mtd_name when
linux,mtd-name is
    not present in the device tree, which causes map.name to be set to a random
    value.  Fix this by initializing mtd_name to NULL.

    Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
    Signed-off-by: Baruch Siach <baruch@tkos.co.il>
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Brian

Patch

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)