[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <07ca2474-560f-4cbb-9740-db987227416a@web.de>
Date: Mon, 25 Dec 2023 20:18:44 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-tegra@...r.kernel.org, kernel-janitors@...r.kernel.org,
Jonathan Hunter <jonathanh@...dia.com>, Justin Stitt
<justinstitt@...gle.com>, Kees Cook <keescook@...omium.org>,
Mikko Perttunen <mperttunen@...dia.com>,
Thierry Reding <thierry.reding@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH] firmware: tegra: bpmp: Return directly after a failed
kzalloc() in get_filename()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 25 Dec 2023 20:03:56 +0100
The kfree() function was called in one case by
the get_filename() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus return directly after a call of the function “kzalloc” failed
at the beginning.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/firmware/tegra/bpmp-debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c
index bbcdd9fed3fb..4221fed70ad4 100644
--- a/drivers/firmware/tegra/bpmp-debugfs.c
+++ b/drivers/firmware/tegra/bpmp-debugfs.c
@@ -77,7 +77,7 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL);
if (!root_path_buf)
- goto out;
+ return NULL;
root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf,
root_path_buf_len);
--
2.43.0
Powered by blists - more mailing lists