1 From 401f68fda0d8dd118ff782637a5f163b59c32700 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 25 Dec 2023 20:03:56 +0100
4 Subject: firmware: tegra: bpmp: Return directly after a failed kzalloc() in
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 From: Markus Elfring <elfring@users.sourceforge.net>
12 [ Upstream commit 1315848f1f8a0100cb6f8a7187bc320c5d98947f ]
14 The kfree() function was called in one case by
15 the get_filename() function during error handling
16 even if the passed variable contained a null pointer.
17 This issue was detected by using the Coccinelle software.
19 Thus return directly after a call of the function “kzalloc” failed
22 Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
23 Signed-off-by: Thierry Reding <treding@nvidia.com>
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 drivers/firmware/tegra/bpmp-debugfs.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
29 diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c
30 index bbcdd9fed3fb6..4221fed70ad48 100644
31 --- a/drivers/firmware/tegra/bpmp-debugfs.c
32 +++ b/drivers/firmware/tegra/bpmp-debugfs.c
33 @@ -77,7 +77,7 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
35 root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL);
40 root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf,