* [PATCH V1] firmware: tegra: fix error application of sizeof to pointer
@ 2021-10-09 8:59 cgel.zte
2021-10-14 18:26 ` Jon Hunter
2021-10-18 14:06 ` Thierry Reding
0 siblings, 2 replies; 5+ messages in thread
From: cgel.zte @ 2021-10-09 8:59 UTC (permalink / raw)
To: thierry.reding
Cc: jonathanh, arnd, lv.ruyi, linux-tegra, linux-kernel, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
Application of sizeof to pointer yields the number of bytes of the pointer,
but it should use the length of buffer in the code.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
drivers/firmware/tegra/bpmp-debugfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c
index 6d66fe03fb6a..fd89899aeeed 100644
--- a/drivers/firmware/tegra/bpmp-debugfs.c
+++ b/drivers/firmware/tegra/bpmp-debugfs.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V1] firmware: tegra: fix error application of sizeof to pointer
2021-10-09 8:59 [PATCH V1] firmware: tegra: fix error application of sizeof to pointer cgel.zte
@ 2021-10-14 18:26 ` Jon Hunter
2021-10-14 18:31 ` Jon Hunter
2021-10-18 14:06 ` Thierry Reding
1 sibling, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2021-10-14 18:26 UTC (permalink / raw)
To: cgel.zte, thierry.reding, arnd
Cc: lv.ruyi, linux-tegra, linux-kernel, Zeal Robot
Hi Lv,
On 09/10/2021 09:59, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> Application of sizeof to pointer yields the number of bytes of the pointer,
> but it should use the length of buffer in the code.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
> drivers/firmware/tegra/bpmp-debugfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c
> index 6d66fe03fb6a..fd89899aeeed 100644
> --- a/drivers/firmware/tegra/bpmp-debugfs.c
> +++ b/drivers/firmware/tegra/bpmp-debugfs.c
> @@ -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;
>
>
Thanks for fixing this! I just noticed that the debugfs for BPMP is
broken on -next right now and this fixes it. We should add the fixes tag ...
Fixes: 06c2d9a078ab ("firmware: tegra: Reduce stack usage")
Otherwise ...
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Arnd, do you want to pick this up?
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V1] firmware: tegra: fix error application of sizeof to pointer
2021-10-14 18:26 ` Jon Hunter
@ 2021-10-14 18:31 ` Jon Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2021-10-14 18:31 UTC (permalink / raw)
To: cgel.zte, thierry.reding, arnd
Cc: lv.ruyi, linux-tegra, linux-kernel, Zeal Robot
On 14/10/2021 19:26, Jon Hunter wrote:
> Hi Lv,
>
> On 09/10/2021 09:59, cgel.zte@gmail.com wrote:
>> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>>
>> Application of sizeof to pointer yields the number of bytes of the
>> pointer,
>> but it should use the length of buffer in the code.
>>
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
>> ---
>> drivers/firmware/tegra/bpmp-debugfs.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/firmware/tegra/bpmp-debugfs.c
>> b/drivers/firmware/tegra/bpmp-debugfs.c
>> index 6d66fe03fb6a..fd89899aeeed 100644
>> --- a/drivers/firmware/tegra/bpmp-debugfs.c
>> +++ b/drivers/firmware/tegra/bpmp-debugfs.c
>> @@ -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;
>>
>
> Thanks for fixing this! I just noticed that the debugfs for BPMP is
> broken on -next right now and this fixes it. We should add the fixes tag
> ...
>
> Fixes: 06c2d9a078ab ("firmware: tegra: Reduce stack usage")
>
> Otherwise ...
>
> Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
> Tested-by: Jon Hunter <jonathanh@nvidia.com>
>
> Arnd, do you want to pick this up?
Nevermind I see that Thierry queued up the offending patch and so I will
ask Thierry to pick this up.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V1] firmware: tegra: fix error application of sizeof to pointer
2021-10-09 8:59 [PATCH V1] firmware: tegra: fix error application of sizeof to pointer cgel.zte
2021-10-14 18:26 ` Jon Hunter
@ 2021-10-18 14:06 ` Thierry Reding
2021-12-04 8:01 ` Jon Hunter
1 sibling, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2021-10-18 14:06 UTC (permalink / raw)
To: cgel.zte; +Cc: jonathanh, arnd, lv.ruyi, linux-tegra, linux-kernel, Zeal Robot
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
On Sat, Oct 09, 2021 at 08:59:00AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> Application of sizeof to pointer yields the number of bytes of the pointer,
> but it should use the length of buffer in the code.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
> drivers/firmware/tegra/bpmp-debugfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V1] firmware: tegra: fix error application of sizeof to pointer
2021-10-18 14:06 ` Thierry Reding
@ 2021-12-04 8:01 ` Jon Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2021-12-04 8:01 UTC (permalink / raw)
To: Thierry Reding, cgel.zte
Cc: arnd, lv.ruyi, linux-tegra, linux-kernel, Zeal Robot
Hi Thierry,
On 18/10/2021 15:06, Thierry Reding wrote:
> On Sat, Oct 09, 2021 at 08:59:00AM +0000, cgel.zte@gmail.com wrote:
>> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>>
>> Application of sizeof to pointer yields the number of bytes of the pointer,
>> but it should use the length of buffer in the code.
>>
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
>> ---
>> drivers/firmware/tegra/bpmp-debugfs.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Applied, thanks.
We need to apply this as a fix for v5.16. I am still seeing a failure
for reading the BPMP debugfs on v5.16-rc3.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-04 8:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 8:59 [PATCH V1] firmware: tegra: fix error application of sizeof to pointer cgel.zte
2021-10-14 18:26 ` Jon Hunter
2021-10-14 18:31 ` Jon Hunter
2021-10-18 14:06 ` Thierry Reding
2021-12-04 8:01 ` Jon Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).