Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbe293db authored by Lam Thai's avatar Lam Thai Committed by Greg Kroah-Hartman
Browse files

bpftool: Fix a wrong type cast in btf_dumper_int



[ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ]

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: b12d6ec0 ("bpf: btf: add btf print functionality")
Signed-off-by: default avatarLam Thai <lamthai@arista.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9ee70c3c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -251,7 +251,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 */