public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: perf: fix augmented syscall format warning
@ 2020-01-13 17:44 Cengiz Can
  2020-01-14 15:47 ` Arnaldo Carvalho de Melo
  2020-01-20  8:27 ` [tip: perf/core] perf beauty sockaddr: Fix " tip-bot2 for Cengiz Can
  0 siblings, 2 replies; 3+ messages in thread
From: Cengiz Can @ 2020-01-13 17:44 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo
  Cc: linux-kernel, Cengiz Can

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.

Not sure about the complications of this with x86 though.

Signed-off-by: Cengiz Can <cengiz@kernel.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: perf: fix augmented syscall format warning
  2020-01-13 17:44 [PATCH] tools: perf: fix augmented syscall format warning Cengiz Can
@ 2020-01-14 15:47 ` Arnaldo Carvalho de Melo
  2020-01-20  8:27 ` [tip: perf/core] perf beauty sockaddr: Fix " tip-bot2 for Cengiz Can
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-01-14 15:47 UTC (permalink / raw)
  To: Cengiz Can; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel

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@kernel.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: perf/core] perf beauty sockaddr: Fix augmented syscall format warning
  2020-01-13 17:44 [PATCH] tools: perf: fix augmented syscall format warning Cengiz Can
  2020-01-14 15:47 ` Arnaldo Carvalho de Melo
@ 2020-01-20  8:27 ` tip-bot2 for Cengiz Can
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Cengiz Can @ 2020-01-20  8:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Cengiz Can, Peter Zijlstra, Arnaldo Carvalho de Melo, x86, LKML

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     49e0b6f4e95aa3ade8f512c50d1ccc113fe917b4
Gitweb:        https://git.kernel.org/tip/49e0b6f4e95aa3ade8f512c50d1ccc113fe917b4
Author:        Cengiz Can <cengiz@kernel.wtf>
AuthorDate:    Mon, 13 Jan 2020 20:44:39 +03:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 14 Jan 2020 12:42:26 -03:00

perf beauty sockaddr: Fix augmented syscall format warning

The 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.

Not sure about the complications of this with x86 though.

Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200113174438.102975-1-cengiz@kernel.wtf
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 173c8f7..e0c13e6 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);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-20  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-13 17:44 [PATCH] tools: perf: fix augmented syscall format warning Cengiz Can
2020-01-14 15:47 ` Arnaldo Carvalho de Melo
2020-01-20  8:27 ` [tip: perf/core] perf beauty sockaddr: Fix " tip-bot2 for Cengiz Can

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox