mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Fix a wrong type cast in btf_dumper_int
When `data` points to a boolean value, casting it to `int *` is problematic
and could lead to a wrong value being passed to `jsonw_bool`. Change the
cast to `bool *` instead.
Fixes: b12d6ec097
("bpf: btf: add btf print functionality")
Signed-off-by: Lam Thai <lamthai@arista.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com
This commit is contained in:
parent
eef3c3d337
commit
7184aef9c0
1 changed files with 1 additions and 1 deletions
|
@ -452,7 +452,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset,
|
||||||
*(char *)data);
|
*(char *)data);
|
||||||
break;
|
break;
|
||||||
case BTF_INT_BOOL:
|
case BTF_INT_BOOL:
|
||||||
jsonw_bool(jw, *(int *)data);
|
jsonw_bool(jw, *(bool *)data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* shouldn't happen */
|
/* shouldn't happen */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue