bpftool: Cast variable var to long long

When the SIGNED condition is met, the variable `var` should be cast to
`long long` instead of `unsigned long long`.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20241112073701.283362-1-luoyifan@cmss.chinamobile.com
This commit is contained in:
Luo Yifan 2024-11-12 15:37:01 +08:00 committed by Andrii Nakryiko
parent a1087da9d1
commit b7b31f184f

View File

@ -289,7 +289,7 @@ static int dump_btf_type(const struct btf *btf, __u32 id,
} else {
if (btf_kflag(t))
printf("\n\t'%s' val=%lldLL", name,
(unsigned long long)val);
(long long)val);
else
printf("\n\t'%s' val=%lluULL", name,
(unsigned long long)val);