Re: [PATCH] bpftool: Fix incorrect format specifier for var

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2024-11-11 10:48 UTC+0800 ~ Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
> In cases where the SIGNED condition is met, the variable var is still
> used as an unsigned long long. Therefore, the %llu format specifier
> should be used to avoid incorrect data print. This patch fixes it.
> 
> Signed-off-by: Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
> ---
>  tools/bpf/bpftool/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
> index 7d2af1ff3..ff58ff85e 100644
> --- a/tools/bpf/bpftool/btf.c
> +++ b/tools/bpf/bpftool/btf.c
> @@ -283,7 +283,7 @@ static int dump_btf_type(const struct btf *btf, __u32 id,
>  				jsonw_end_object(w);
>  			} else {
>  				if (btf_kflag(t))
> -					printf("\n\t'%s' val=%lldLL", name,
> +					printf("\n\t'%s' val=%lluLL", name,
>  					       (unsigned long long)val);
>  				else
>  					printf("\n\t'%s' val=%lluULL", name,


Hi, I don't think your change is correct, it seems to me that we do want
to make the distinction between the signed and unsigned version here (as
for all the other enum cases in the function). What are you trying to
address, did you find a bug in the output or a warning during compilation?

Quentin




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux