From: sashiko-bot@kernel.org
To: "Alan Maguire" <alan.maguire@oracle.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next 7/8] selftests/bpf: Fix up __u16 vlen assumptions
Date: Thu, 16 Apr 2026 20:32:13 +0000 [thread overview]
Message-ID: <20260416203213.D04CCC2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416143904.1220662-8-alan.maguire@oracle.com>
Sashiko AI review found 1 potential issue(s):
- [Medium] The patch fails to fix the 16-bit assumption for `vlen` in `tools/testing/selftests/bpf/prog_tests/ctx_rewrite.c`.
--
commit 033bc70f770dbba15f69901f422f7378dd7cd70e
Author: Alan Maguire <alan.maguire@oracle.com>
selftests/bpf: Fix up __u16 vlen assumptions
Fix up a few cases where we assume vlen is 16 bits.
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
> index 0cc347e32db37..a9de328a86976 100644
> --- a/tools/testing/selftests/bpf/prog_tests/btf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/btf.c
> @@ -8092,7 +8092,7 @@ static struct btf_dedup_test dedup_tests[] = {
> static int btf_type_size(const struct btf_type *t)
> {
> int base_size = sizeof(struct btf_type);
> - __u16 vlen = BTF_INFO_VLEN(t->info);
> + __u32 vlen = BTF_INFO_VLEN(t->info);
> __u16 kind = BTF_INFO_KIND(t->info);
Does tools/testing/selftests/bpf/prog_tests/ctx_rewrite.c also need to be
updated to handle 24-bit vlen values?
Looking at find_field_offset_aux(), mnum is still declared as __u16 and
assigned the result of btf_vlen():
tools/testing/selftests/bpf/prog_tests/ctx_rewrite.c:find_field_offset_aux() {
const struct btf_type *type = btf__type_by_id(btf, btf_id);
const struct btf_member *m;
__u16 mnum;
int i;
...
m = btf_members(type);
mnum = btf_vlen(type);
for (i = 0; i < mnum; ++i, ++m) {
...
}
If a structure or union has more than 65,535 members, could mnum be
truncated here, causing the loop to terminate prematurely and failing to
resolve field offsets?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416143904.1220662-1-alan.maguire@oracle.com?part=7
next prev parent reply other threads:[~2026-04-16 20:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 14:38 [PATCH v2 bpf-next 0/8] bpf: Extend BTF UAPI vlen, kinds to use unused bits Alan Maguire
2026-04-16 14:38 ` [PATCH v2 bpf-next 1/8] " Alan Maguire
2026-04-16 15:54 ` Alexei Starovoitov
2026-04-16 19:05 ` sashiko-bot
2026-04-16 14:38 ` [PATCH v2 bpf-next 2/8] libbpf: Adjust btf_vlen() to return a __u32 Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 19:36 ` sashiko-bot
2026-04-16 14:38 ` [PATCH v2 bpf-next 3/8] libbpf: Add feature for kernel extended vlen/kind support Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 15:56 ` Alexei Starovoitov
2026-04-16 16:08 ` Alan Maguire
2026-04-16 20:01 ` sashiko-bot
2026-04-16 14:39 ` [PATCH v2 bpf-next 4/8] bpftool: Support 24-bit vlen Alan Maguire
2026-04-16 15:15 ` bot+bpf-ci
2026-04-16 14:39 ` [PATCH v2 bpf-next 5/8] selftests/bpf: Test BTF sanitization rejection for invalid vlen Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 20:20 ` sashiko-bot
2026-04-16 14:39 ` [PATCH v2 bpf-next 6/8] selftests/bpf: Fix up btf/invalid test for extended kind Alan Maguire
2026-04-16 14:39 ` [PATCH v2 bpf-next 7/8] selftests/bpf: Fix up __u16 vlen assumptions Alan Maguire
2026-04-16 20:32 ` sashiko-bot [this message]
2026-04-16 14:39 ` [PATCH v2 bpf-next 8/8] Documentation/bpf: Update btf doc with updated vlen, kind sizes Alan Maguire
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=20260416203213.D04CCC2BCAF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko@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 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.