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

login
register
mail settings
Submitter Baruch Siach
Date Dec. 23, 2012, 11:10 a.m.
Message ID <df9da712b775781366ae23aac28ed20849b4e4d3.1356260943.git.baruch@tkos.co.il>
Download mbox | patch
Permalink /patch/207967/
State Accepted
Commit 7dfe4be351e81656ca1068e5d4ead235c7ba94b1
Headers show

Comments

Baruch Siach - Dec. 23, 2012, 11:10 a.m.
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>
---
 drivers/mtd/maps/physmap_of.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Baruch Siach - Jan. 24, 2013, 9:05 a.m.
Hi linux-mtd, Artem, David,

Ping?

It's been a month, and this is a simple uninitialized pointer dereference bug 
fix.

baruch

On Sun, Dec 23, 2012 at 01:10:50PM +0200, Baruch Siach wrote:
> 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>
> ---
>  drivers/mtd/maps/physmap_of.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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)
Artem Bityutskiy - Jan. 28, 2013, 4:02 p.m.
I pinged dwmw2 about this already. This is his call to merge the driver.
I will ping him again.

On Thu, 2013-01-24 at 11:05 +0200, Baruch Siach wrote:
> Hi linux-mtd, Artem, David,
> 
> Ping?
> 
> It's been a month, and this is a simple uninitialized pointer dereference bug 
> fix.
> 
> baruch
> 
> On Sun, Dec 23, 2012 at 01:10:50PM +0200, Baruch Siach wrote:
> > 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>
> > ---
> >  drivers/mtd/maps/physmap_of.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 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)
>
Artem Bityutskiy - Jan. 28, 2013, 4:12 p.m.
On Thu, 2013-01-24 at 11:05 +0200, Baruch Siach wrote:
> Hi linux-mtd, Artem, David,
> 
> Ping?
> 
> It's been a month, and this is a simple uninitialized pointer dereference bug 
> fix.

It is in linux-mtd now.

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)