Skip to content

Commit

Permalink
firmware: tegra: bpmp: Return directly after a failed kzalloc() in ge…
Browse files Browse the repository at this point in the history
…t_filename()

[ Upstream commit 1315848 ]

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>
  • Loading branch information
elfring authored and gregkh committed Apr 13, 2024
1 parent 1b2b265 commit 5dc5f8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firmware/tegra/bpmp-debugfs.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5dc5f8c

Please sign in to comment.