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()

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>
  • Loading branch information
elfring authored and thierryreding committed Feb 21, 2024
1 parent 6613476 commit 1315848
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firmware/tegra/bpmp-debugfs.c
Original file line number Diff line number Diff line change
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 1315848

Please sign in to comment.