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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 175086c commit 3959998

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)