mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
misc: fastrpc: check return value of devm_kasprintf()
devm_kasprintf() returns a pointer to dynamically allocated memory.
Pointer could be NULL in case allocation fails. Check pointer validity.
Identified with coccinelle (kmerr.cocci script).
Fixes: 3abe3ab3cd
("misc: fastrpc: add secure domain support")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230615102546.581899-1-claudiu.beznea@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
afc5fddd39
commit
af2e19d82a
@@ -2225,6 +2225,9 @@ static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ct
|
|||||||
fdev->miscdev.fops = &fastrpc_fops;
|
fdev->miscdev.fops = &fastrpc_fops;
|
||||||
fdev->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "fastrpc-%s%s",
|
fdev->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "fastrpc-%s%s",
|
||||||
domain, is_secured ? "-secure" : "");
|
domain, is_secured ? "-secure" : "");
|
||||||
|
if (!fdev->miscdev.name)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
err = misc_register(&fdev->miscdev);
|
err = misc_register(&fdev->miscdev);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (is_secured)
|
if (is_secured)
|
||||||
|
Reference in New Issue
Block a user