]> git.itanic.dy.fi Git - linux-stable/commitdiff
firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename()
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 25 Dec 2023 19:03:56 +0000 (20:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:09:59 +0000 (13:09 +0200)
[ Upstream commit 1315848f1f8a0100cb6f8a7187bc320c5d98947f ]

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@users.sourceforge.net>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/tegra/bpmp-debugfs.c

index bbcdd9fed3fb61625105121e026c1a70cb01e1e4..4221fed70ad48c8d82b29279ecd47db8d968c973 100644 (file)
@@ -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);