Skip to content

Commit 3959998

Browse files
Charles Hanmiquelraynal
authored andcommitted
mtd: powernv: Add check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked. Fixes: acfe63e ("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
1 parent 175086c commit 3959998

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/mtd/devices/powernv_flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ static int powernv_flash_set_driver_info(struct device *dev,
207207
* get them
208208
*/
209209
mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
210+
if (!mtd->name)
211+
return -ENOMEM;
212+
210213
mtd->type = MTD_NORFLASH;
211214
mtd->flags = MTD_WRITEABLE;
212215
mtd->size = size;

0 commit comments

Comments
 (0)