All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] perf: Fix up build failure due to bpf changes
@ 2026-06-17 13:00 Mark Brown
  2026-06-17 15:44 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2026-06-17 13:00 UTC (permalink / raw)
  To: Linus Torvalds, Arnaldo Carvalho de Melo, Alan Maguire,
	Alexei Starovoitov
  Cc: linux-perf-users, bpf, Mark Brown

Fix

util/btf.c: In function '__btf_type__find_member_by_name':
util/btf.c:19:43: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
   19 |         for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
      |                                           ^

builtin-trace.c: In function 'syscall_arg__strtoul_btf_enum':
builtin-trace.c:967:27: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
  967 |         for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
      |                           ^

by making the variable the same type as the function.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
v2: Fix a second error.

 tools/perf/builtin-trace.c | 2 +-
 tools/perf/util/btf.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 48615ddccd93a..4b23b82732e74 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -964,7 +964,7 @@ static bool syscall_arg__strtoul_btf_enum(char *bf, size_t size, struct syscall_
 	struct btf *btf = arg->trace->btf;
 	struct btf_enum *be = btf_enum(bt);
 
-	for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
+	for (u32 i = 0; i < btf_vlen(bt); ++i, ++be) {
 		const char *name = btf__name_by_offset(btf, be->name_off);
 		int max_len = max(size, strlen(name));
 
diff --git a/tools/perf/util/btf.c b/tools/perf/util/btf.c
index bb163fe87767c..50d98f3e83bf0 100644
--- a/tools/perf/util/btf.c
+++ b/tools/perf/util/btf.c
@@ -14,7 +14,7 @@ const struct btf_member *__btf_type__find_member_by_name(struct btf *btf,
 {
 	const struct btf_type *t = btf__type_by_id(btf, type_id);
 	const struct btf_member *m;
-	int i;
+	u32 i;
 
 	for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
 		const char *current_member_name = btf__name_by_offset(btf, m->name_off);
-- 
2.47.3


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

* Re: [PATCH v2] perf: Fix up build failure due to bpf changes
  2026-06-17 13:00 [PATCH v2] perf: Fix up build failure due to bpf changes Mark Brown
@ 2026-06-17 15:44 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-06-17 15:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linus Torvalds, Arnaldo Carvalho de Melo, Alan Maguire,
	Alexei Starovoitov, linux-perf-users, bpf

On Wed, Jun 17, 2026 at 02:00:38PM +0100, Mark Brown wrote:
> Fix
> 
> util/btf.c: In function '__btf_type__find_member_by_name':
> util/btf.c:19:43: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
>    19 |         for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
>       |                                           ^
> 
> builtin-trace.c: In function 'syscall_arg__strtoul_btf_enum':
> builtin-trace.c:967:27: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
>   967 |         for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
>       |                           ^
> 
> by making the variable the same type as the function.

Thanks, applied to perf-tools-next, for v7.2.

- Arnaldo
 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> v2: Fix a second error.
> 
>  tools/perf/builtin-trace.c | 2 +-
>  tools/perf/util/btf.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 48615ddccd93a..4b23b82732e74 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -964,7 +964,7 @@ static bool syscall_arg__strtoul_btf_enum(char *bf, size_t size, struct syscall_
>  	struct btf *btf = arg->trace->btf;
>  	struct btf_enum *be = btf_enum(bt);
>  
> -	for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
> +	for (u32 i = 0; i < btf_vlen(bt); ++i, ++be) {
>  		const char *name = btf__name_by_offset(btf, be->name_off);
>  		int max_len = max(size, strlen(name));
>  
> diff --git a/tools/perf/util/btf.c b/tools/perf/util/btf.c
> index bb163fe87767c..50d98f3e83bf0 100644
> --- a/tools/perf/util/btf.c
> +++ b/tools/perf/util/btf.c
> @@ -14,7 +14,7 @@ const struct btf_member *__btf_type__find_member_by_name(struct btf *btf,
>  {
>  	const struct btf_type *t = btf__type_by_id(btf, type_id);
>  	const struct btf_member *m;
> -	int i;
> +	u32 i;
>  
>  	for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
>  		const char *current_member_name = btf__name_by_offset(btf, m->name_off);
> -- 
> 2.47.3
> 
> 

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

end of thread, other threads:[~2026-06-17 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 13:00 [PATCH v2] perf: Fix up build failure due to bpf changes Mark Brown
2026-06-17 15:44 ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.