From: sashiko-bot@kernel.org
To: "Alan Maguire" <alan.maguire@oracle.com>
Cc: linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH perf] perf: Fix btf_vlen() signedness errors
Date: Mon, 22 Jun 2026 10:50:18 +0000 [thread overview]
Message-ID: <20260622105019.5244C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622103418.579115-1-alan.maguire@oracle.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] Silent truncation of BTF_INFO_VLEN in libbpf's btf_vlen()
--
commit c28608c8a13cb7af8bf42f5aaadf102bb452fc40
Author: Alan Maguire <alan.maguire@oracle.com>
perf: Fix btf_vlen() signedness errors
This commit updates perf to use unsigned int loop counters when
iterating up to btf_vlen(). This avoids signedness errors after commit
f7a6b9eaff3e6 extended the BTF UAPI vlen to use previously unused bits.
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 48615ddccd93a..9903d79c4b77a 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) {
[Severity: Medium]
This is a pre-existing issue, but does the btf_vlen function still silently
truncate the newly extended length?
Looking at tools/lib/bpf/btf.h, it appears to be defined as:
static inline __u16 btf_vlen(const struct btf_type *t)
{
return BTF_INFO_VLEN(t->info);
}
Since commit f7a6b9eaff3e6 extended the internal BTF_INFO_VLEN from 16 to
24 bits to support more than 65535 elements, won't returning __u16 here
truncate the upper 8 bits?
While updating the loop variables to unsigned int fixes the signedness
warnings in consumers, does the underlying library still need an update to
return __u32 and prevent truncation?
> const char *name = btf__name_by_offset(btf, be->name_off);
> int max_len = max(size, strlen(name));
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260622103418.579115-1-alan.maguire@oracle.com?part=1
next prev parent reply other threads:[~2026-06-22 10:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 10:34 [PATCH perf] perf: Fix btf_vlen() signedness errors Alan Maguire
2026-06-22 10:50 ` sashiko-bot [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=20260622105019.5244C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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