mtd: atmel_nand: fix null pointer dereference
PATCH 1/1 mtd: atmel_nand: fix null pointer dereference
We need to allocate pdata for device tree and non device tree probe. In device tree probe we use pdata to fill structure member with dts data. In non device tree probe we use the pdata to handle platform_data.
--- drivers/mtd/nand/atmel_nand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/atmel_nand.c +4 -4
@@ -1194,6 +1194,10 @@ static int __init atmel_nand_probe(struct device_d *dev)if (!host)return -ENOMEM ; + pdata =kzalloc (sizeof (struct atmel_nand_data ),GFP_KERNEL ); +if (!pdata) +return -ENOMEM ; + host->io_base =dev_request_mem_region (dev,0 ); mtd = &host->mtd;
@@ -1206,10 +1210,6 @@ static int __init atmel_nand_probe(struct device_d *dev)if (res) goto err_no_card; }else { - pdata =kzalloc (sizeof (struct atmel_nand_data ),GFP_KERNEL ); -if (!pdata) -return -ENOMEM ; -memcpy (host->board, dev->platform_data,sizeof (struct atmel_nand_data )); }
Signature · 7 lines
1.8.3.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
I think this patch could be squash in [PATCH v3 3/3] mtd: atmel_nand:
add support for device tree
2014-09-02 21:02 GMT+02:00 Raphaël Poggi <[email protected]>:
Quoted 36 lines
We need to allocate pdata for device tree and non device tree probe. In device tree probe we use pdata to fill structure member with dts data. In non device tree probe we use the pdata to handle
platform_data.Signed-off-by Raphaël Poggi <[email protected]>--- drivers/mtd/nand/atmel_nand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/mtd/nand/atmel_nand.c +4
-5@@ -1194,6 +1194,10 @@ static int __init atmel_nand_probe(struct device_d *dev)if (!host)return -ENOMEM ; + pdata =kzalloc (sizeof (struct atmel_nand_data ),GFP_KERNEL ); +if (!pdata) +return -ENOMEM ; + host->io_base =dev_request_mem_region (dev,0 ); mtd = &host->mtd;@@ -1206,10 +1210,6 @@ static int __init atmel_nand_probe(struct device_d *dev)if (res) goto err_no_card; }else { - pdata =kzalloc (sizeof (struct atmel_nand_data ),GFP_KERNEL ); -if (!pdata) -return -ENOMEM ; -memcpy (host->board, dev->platform_data,sizeof (struct atmel_nand_data )); } --
Quoted 2 lines
1.8.3.2
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 2 lines · Raphaël Poggi
I think this patch could be squash in [PATCH v3 3/3] mtd:
atmel_nand:
add support for device tree
Did that, thanks.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox