UPSTREAM: firmware: tegra: Fix error application of sizeof() to pointer

Application of sizeof() to pointer yields the number of bytes of the
pointer, but it should use the length of buffer in the code.

Bug: 254441685
Fixes: 06c2d9a078ab ("firmware: tegra: Reduce stack usage")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 711e26c00e4c7b7cef0420c76a61e6d818e12687)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ide1f9cbc31fea6fbb1d74f7ad4bbb6bef7caa0a9
This commit is contained in:
Lv Ruyi
2021-10-09 08:59:00 +00:00
committed by Lee Jones
parent 1b3cfadf63
commit 3815eca894

View File

@@ -77,13 +77,14 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
const char *root_path, *filename = NULL;
char *root_path_buf;
size_t root_len;
size_t root_path_buf_len = 512;
root_path_buf = kzalloc(512, GFP_KERNEL);
root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL);
if (!root_path_buf)
goto out;
root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf,
sizeof(root_path_buf));
root_path_buf_len);
if (IS_ERR(root_path))
goto out;