[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200114154718.GC20569@kernel.org>
Date: Tue, 14 Jan 2020 12:47:18 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Cengiz Can <cengiz@...nel.wtf>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tools: perf: fix augmented syscall format warning
Em Mon, Jan 13, 2020 at 08:44:39PM +0300, Cengiz Can escreveu:
> sockaddr related examples given in
> `tools/perf/examples/bpf/augmented_syscalls.c` almost always use `long`s
> to represent most of their fields.
>
> However, `size_t syscall_arg__scnprintf_sockaddr(..)` has a `scnprintf`
> call that uses `"%#x"` as format string.
>
> This throws a warning (whenever the syscall argument is `unsigned
> long`).
>
> Added `l` identifier to indicate that the `arg->value` is an unsigned
> long.
arg->val is a 'unsigned long', so yeah, we can make that lx to make it
work in more places,
In fact it should be fallbacking to this, that does just like you did
here:
size_t syscall_arg__scnprintf_hex(char *bf, size_t size, struct syscall_arg *arg)
{
return scnprintf(bf, size, "%#lx", arg->val);
}
It is in tools/perf/builtin-trace.c
Thanks,
- Arnaldo
> Not sure about the complications of this with x86 though.
>
> Signed-off-by: Cengiz Can <cengiz@...nel.wtf>
> ---
> tools/perf/trace/beauty/sockaddr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/trace/beauty/sockaddr.c b/tools/perf/trace/beauty/sockaddr.c
> index 173c8f760763..e0c13e6a5788 100644
> --- a/tools/perf/trace/beauty/sockaddr.c
> +++ b/tools/perf/trace/beauty/sockaddr.c
> @@ -72,5 +72,5 @@ size_t syscall_arg__scnprintf_sockaddr(char *bf, size_t size, struct syscall_arg
> if (arg->augmented.args)
> return syscall_arg__scnprintf_augmented_sockaddr(arg, bf, size);
>
> - return scnprintf(bf, size, "%#x", arg->val);
> + return scnprintf(bf, size, "%#lx", arg->val);
> }
> --
> 2.24.1
>
--
- Arnaldo
Powered by blists - more mailing lists