mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
mtd: powernv: Add check devm_kasprintf() returned value
[ Upstream commit3959998298
] devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked. Fixes:acfe63ec1c
("mtd: Convert to using %pOFn instead of device_node.name") Signed-off-by: Charles Han <hanchunchao@inspur.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240828092427.128177-1-hanchunchao@inspur.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e109a01f3d
commit
4e31e50420
|
@ -207,6 +207,9 @@ static int powernv_flash_set_driver_info(struct device *dev,
|
|||
* get them
|
||||
*/
|
||||
mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
|
||||
if (!mtd->name)
|
||||
return -ENOMEM;
|
||||
|
||||
mtd->type = MTD_NORFLASH;
|
||||
mtd->flags = MTD_WRITEABLE;
|
||||
mtd->size = size;
|
||||
|
|
Loading…
Reference in New Issue
Block a user