mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH perf] perf: Fix btf_vlen() signedness errors
@ 2026-06-22 10:34 Alan Maguire
  2026-06-22 10:53 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Maguire @ 2026-06-22 10:34 UTC (permalink / raw)
  To: peterz, acme
  Cc: mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, james.clark, linux-perf-users,
	linux-kernel, bpf, Alan Maguire, Mark Brown

Commit f7a6b9eaff3e6 ("bpf: Extend BTF UAPI vlen, kinds to use unused bits")

extended the return value for btf_vlen() to __u32, triggering
errors for cases where an int was used to store return value.
Fix these cases for perf as was done for other libbpf consumers.

Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tools/perf/builtin-trace.c | 6 +++---
 tools/perf/util/btf.c      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 48615ddccd93..9903d79c4b77 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 (unsigned int 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));
 
@@ -1009,9 +1009,9 @@ static bool syscall_arg__strtoul_btf_type(char *bf, size_t size, struct syscall_
 static size_t btf_enum_scnprintf(const struct btf_type *type, struct btf *btf, char *bf, size_t size, int val)
 {
 	struct btf_enum *be = btf_enum(type);
-	const int nr_entries = btf_vlen(type);
+	const unsigned int nr_entries = btf_vlen(type);
 
-	for (int i = 0; i < nr_entries; ++i, ++be) {
+	for (unsigned int i = 0; i < nr_entries; ++i, ++be) {
 		if (be->val == val) {
 			return scnprintf(bf, size, "%s",
 					 btf__name_by_offset(btf, be->name_off));
diff --git a/tools/perf/util/btf.c b/tools/perf/util/btf.c
index bb163fe87767..1716b49d3568 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;
+	unsigned int 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] 5+ messages in thread

* Re: [PATCH perf] perf: Fix btf_vlen() signedness errors
  2026-06-22 10:34 [PATCH perf] perf: Fix btf_vlen() signedness errors Alan Maguire
@ 2026-06-22 10:53 ` Mark Brown
  2026-06-22 11:09   ` Arnaldo Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-06-22 10:53 UTC (permalink / raw)
  To: Alan Maguire
  Cc: peterz, acme, mingo, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, james.clark, linux-perf-users,
	linux-kernel, bpf

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

On Mon, Jun 22, 2026 at 11:34:18AM +0100, Alan Maguire wrote:
> Commit f7a6b9eaff3e6 ("bpf: Extend BTF UAPI vlen, kinds to use unused bits")
> 
> extended the return value for btf_vlen() to __u32, triggering
> errors for cases where an int was used to store return value.
> Fix these cases for perf as was done for other libbpf consumers.

I already sent:

  https://lore.kernel.org/r/20260617130038.34534-1-broonie@kernel.org

which I have been using as a fixup since I originally reported the issue
since Linus' tree is broken, Arnaldo said he'd applied it to the
perf-tools-next branch but it has not yet appeared in Linus' tree (and
it looks like he forgot to push it so his copy isn't getting picked up
in the merge either, the last update was on the 15th).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

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

* Re: [PATCH perf] perf: Fix btf_vlen() signedness errors
  2026-06-22 10:53 ` Mark Brown
@ 2026-06-22 11:09   ` Arnaldo Melo
  2026-06-22 11:18     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Melo @ 2026-06-22 11:09 UTC (permalink / raw)
  To: Mark Brown, Alan Maguire
  Cc: peterz, acme, mingo, namhyung, mark.rutland, alexander.shishkin,
	jolsa, irogers, adrian.hunter, james.clark, linux-perf-users,
	linux-kernel, bpf



On June 22, 2026 7:53:40 AM GMT-03:00, Mark Brown <broonie@kernel.org> wrote:
>On Mon, Jun 22, 2026 at 11:34:18AM +0100, Alan Maguire wrote:
>> Commit f7a6b9eaff3e6 ("bpf: Extend BTF UAPI vlen, kinds to use unused bits")
>> 
>> extended the return value for btf_vlen() to __u32, triggering
>> errors for cases where an int was used to store return value.
>> Fix these cases for perf as was done for other libbpf consumers.
>
>I already sent:
>
>  https://lore.kernel.org/r/20260617130038.34534-1-broonie@kernel.org
>
>which I have been using as a fixup since I originally reported the issue
>since Linus' tree is broken, Arnaldo said he'd applied it to the
>perf-tools-next branch but it has not yet appeared in Linus' tree (and
>it looks like he forgot to push it so his copy isn't getting picked up
>in the merge either, the last update was on the 15th).

Its here:

<https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/commit/?h=perf-tools-next&id=776bd9ac834556ab6ff6b7ef74b71ac53d37855e>

I think Alan's latest patch has one more hunk, I'll get that one in and then send the pull request to Linus today,

- Arnaldo

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

* Re: [PATCH perf] perf: Fix btf_vlen() signedness errors
  2026-06-22 11:09   ` Arnaldo Melo
@ 2026-06-22 11:18     ` Mark Brown
  2026-06-22 11:31       ` Arnaldo Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-06-22 11:18 UTC (permalink / raw)
  To: Arnaldo Melo
  Cc: Alan Maguire, peterz, acme, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, irogers, adrian.hunter, james.clark,
	linux-perf-users, linux-kernel, bpf

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

On Mon, Jun 22, 2026 at 08:09:33AM -0300, Arnaldo Melo wrote:
> On June 22, 2026 7:53:40 AM GMT-03:00, Mark Brown <broonie@kernel.org> wrote:

> >which I have been using as a fixup since I originally reported the issue
> >since Linus' tree is broken, Arnaldo said he'd applied it to the
> >perf-tools-next branch but it has not yet appeared in Linus' tree (and
> >it looks like he forgot to push it so his copy isn't getting picked up
> >in the merge either, the last update was on the 15th).

> Its here:

> <https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/commit/?h=perf-tools-next&id=776bd9ac834556ab6ff6b7ef74b71ac53d37855e>

Ah, so it is - I missed it because Ian's series was applied on top of it
and doesn't look at all like fixes so I stopped reading the log (should
it be in -next given the merge window?).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH perf] perf: Fix btf_vlen() signedness errors
  2026-06-22 11:18     ` Mark Brown
@ 2026-06-22 11:31       ` Arnaldo Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Melo @ 2026-06-22 11:31 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alan Maguire, peterz, acme, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, irogers, adrian.hunter, james.clark,
	linux-perf-users, linux-kernel, bpf



On June 22, 2026 8:18:43 AM GMT-03:00, Mark Brown <broonie@kernel.org> wrote:
>On Mon, Jun 22, 2026 at 08:09:33AM -0300, Arnaldo Melo wrote:
>> On June 22, 2026 7:53:40 AM GMT-03:00, Mark Brown <broonie@kernel.org> wrote:
>
>> >which I have been using as a fixup since I originally reported the issue
>> >since Linus' tree is broken, Arnaldo said he'd applied it to the
>> >perf-tools-next branch but it has not yet appeared in Linus' tree (and
>> >it looks like he forgot to push it so his copy isn't getting picked up
>> >in the merge either, the last update was on the 15th).
>
>> Its here:
>
>> <https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/commit/?h=perf-tools-next&id=776bd9ac834556ab6ff6b7ef74b71ac53d37855e>
>
>Ah, so it is - I missed it because Ian's series was applied on top of it
>and doesn't look at all like fixes so I stopped reading the log (should
>it be in -next given the merge window?).

Ian's series? Yeah, I was unsure about having it in this merge window, it went thru many versions, but your question is a fair one, I'll move it to the next merge window and send only up to your fix (+ Alan's missing hunk),

- Arnaldo

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

end of thread, other threads:[~2026-06-22 11:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 10:34 [PATCH perf] perf: Fix btf_vlen() signedness errors Alan Maguire
2026-06-22 10:53 ` Mark Brown
2026-06-22 11:09   ` Arnaldo Melo
2026-06-22 11:18     ` Mark Brown
2026-06-22 11:31       ` Arnaldo Melo

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

all inboxes | Powered by JetHome®