diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2023-06-15 13:25:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-07-19 17:21:58 +0300 |
commit | 94f3bcfcd17c7e932e2431dbbc7b172d4b647c11 (patch) | |
tree | d1b4c6bb327485241357a660c669fbaa18fff309 /drivers | |
parent | 7e3ee25e8c7c7be1eacdfc6d9f5f0e550a2af241 (diff) | |
download | linux-94f3bcfcd17c7e932e2431dbbc7b172d4b647c11.tar.xz |
misc: fastrpc: check return value of devm_kasprintf()
[ Upstream commit af2e19d82a116bc622eea84c9faadd5f7e20bec4 ]
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: 3abe3ab3cdab ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/fastrpc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 8b1e8661c3d7..e5cabb901213 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2030,6 +2030,9 @@ static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ct fdev->miscdev.fops = &fastrpc_fops; fdev->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "fastrpc-%s%s", domain, is_secured ? "-secure" : ""); + if (!fdev->miscdev.name) + return -ENOMEM; + err = misc_register(&fdev->miscdev); if (!err) { if (is_secured) |