Commit 711e26c0 authored by Lv Ruyi's avatar Lv Ruyi Committed by Thierry Reding
Browse files

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.

Fixes: 06c2d9a0 ("firmware: tegra: Reduce stack usage")
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarLv Ruyi <lv.ruyi@zte.com.cn>
Reviewed-by: default avatarJon Hunter <jonathanh@nvidia.com>
Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent f11c34bd
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;