[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <d94376b6-12e8-45bb-a9be-4887bb316d35@web.de>
Date: Sat, 27 Jan 2024 15:55:19 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-fpga@...r.kernel.org, kernel-janitors@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Luwei Kang <luwei.kang@...el.com>, Moritz Fischer <mdf@...nel.org>,
Tom Rix <trix@...hat.com>, Wu Hao <hao.wu@...el.com>,
Xu Yilun <yilun.xu@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH] fpga: dfl: fme: Return directly after a failed
devm_kasprintf() call in fme_perf_pmu_register()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 27 Jan 2024 15:43:42 +0100
The result from a call of the function “devm_kasprintf” was passed to
a subsequent function call without checking for a null pointer before
(according to a memory allocation failure).
This issue was detected by using the Coccinelle software.
Thus return directly after a failed devm_kasprintf() call.
Fixes: 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/fpga/dfl-fme-perf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
index 7422d2bc6f37..db56d52411ef 100644
--- a/drivers/fpga/dfl-fme-perf.c
+++ b/drivers/fpga/dfl-fme-perf.c
@@ -925,6 +925,8 @@ static int fme_perf_pmu_register(struct platform_device *pdev,
PERF_PMU_CAP_NO_EXCLUDE;
name = devm_kasprintf(priv->dev, GFP_KERNEL, "dfl_fme%d", pdev->id);
+ if (!name)
+ return -ENOMEM;
ret = perf_pmu_register(pmu, name, -1);
if (ret)
--
2.43.0
Powered by blists - more mailing lists