From: Alan Maguire <alan.maguire@oracle.com>
To: peterz@infradead.org, acme@kernel.org
Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
Alan Maguire <alan.maguire@oracle.com>,
Mark Brown <broonie@kernel.org>
Subject: [PATCH perf] perf: Fix btf_vlen() signedness errors
Date: Mon, 22 Jun 2026 11:34:18 +0100 [thread overview]
Message-ID: <20260622103418.579115-1-alan.maguire@oracle.com> (raw)
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
next reply other threads:[~2026-06-22 10:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 10:34 Alan Maguire [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260622103418.579115-1-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bpf@vger.kernel.org \
--cc=broonie@kernel.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®