* [PATCH] libbpf: Fix signedness bug in btf_dump_array_data()
@ 2022-02-08 7:15 Dan Carpenter
2022-02-08 16:08 ` Yonghong Song
2022-02-08 21:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-02-08 7:15 UTC (permalink / raw)
To: Alexei Starovoitov, Alan Maguire
Cc: Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, bpf, kernel-janitors
The btf__resolve_size() function returns negative error codes so
"elem_size" must be signed for the error handling to work.
Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
tools/lib/bpf/btf_dump.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index b9a3260c83cb..55aed9e398c3 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -1861,14 +1861,15 @@ static int btf_dump_array_data(struct btf_dump *d,
{
const struct btf_array *array = btf_array(t);
const struct btf_type *elem_type;
- __u32 i, elem_size = 0, elem_type_id;
+ __u32 i, elem_type_id;
+ __s64 elem_size;
bool is_array_member;
elem_type_id = array->type;
elem_type = skip_mods_and_typedefs(d->btf, elem_type_id, NULL);
elem_size = btf__resolve_size(d->btf, elem_type_id);
if (elem_size <= 0) {
- pr_warn("unexpected elem size %d for array type [%u]\n", elem_size, id);
+ pr_warn("unexpected elem size %lld for array type [%u]\n", elem_size, id);
return -EINVAL;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libbpf: Fix signedness bug in btf_dump_array_data()
2022-02-08 7:15 [PATCH] libbpf: Fix signedness bug in btf_dump_array_data() Dan Carpenter
@ 2022-02-08 16:08 ` Yonghong Song
2022-02-08 21:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-02-08 16:08 UTC (permalink / raw)
To: Dan Carpenter, Alexei Starovoitov, Alan Maguire
Cc: Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
John Fastabend, KP Singh, bpf, kernel-janitors
On 2/7/22 11:15 PM, Dan Carpenter wrote:
> The btf__resolve_size() function returns negative error codes so
> "elem_size" must be signed for the error handling to work.
>
> Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libbpf: Fix signedness bug in btf_dump_array_data()
2022-02-08 7:15 [PATCH] libbpf: Fix signedness bug in btf_dump_array_data() Dan Carpenter
2022-02-08 16:08 ` Yonghong Song
@ 2022-02-08 21:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-08 21:40 UTC (permalink / raw)
To: Dan Carpenter
Cc: ast, alan.maguire, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, bpf, kernel-janitors
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Tue, 8 Feb 2022 10:15:52 +0300 you wrote:
> The btf__resolve_size() function returns negative error codes so
> "elem_size" must be signed for the error handling to work.
>
> Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> tools/lib/bpf/btf_dump.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Here is the summary with links:
- libbpf: Fix signedness bug in btf_dump_array_data()
https://git.kernel.org/bpf/bpf-next/c/4172843ed4a3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-08 22:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 7:15 [PATCH] libbpf: Fix signedness bug in btf_dump_array_data() Dan Carpenter
2022-02-08 16:08 ` Yonghong Song
2022-02-08 21:40 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.