Re: [PATCH bpf-next 6/6] selftests/bpf: Fix up btf/invalid test for extended kind

sashiko-bot
2026-04-14T22:32:25Z

Sashiko AI review found 1 potential issue(s):
- [Low] The selftest uses a hardcoded BTF kind value of 32 (0x20000000) to test for an 'Invalid kind', which introduces test fragility.
--

commit bc86ba6ba24921947f8757ebe8a56756c77195e9
Author: Alan Maguire <alan.maguire@oracle.com>

selftests/bpf: Fix up btf/invalid test for extended kind

With extended kinds, 32 becomes a valid (but not used) BTF info kind value;
fix up the test to check for the "Invalid kind" rather than "Invalid btf_info"
message.

> diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
> index 054ecb6b1e9f1..07b1ee0eba372 100644
> --- a/tools/testing/selftests/bpf/prog_tests/btf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/btf.c
> @@ -1924,7 +1924,7 @@ static struct btf_raw_test raw_tests[] = {
> },
>
> {
> - .descr = "invalid BTF_INFO",
> + .descr = "invalid BTF kind",
> .raw_types = {
> /* int */ /* [1] */
> BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
> BTF_TYPE_ENC(0, 0x20000000, 4),

Since the reason for extending the kind field was to support more than 32
kinds, does using a hardcoded kind value of 32 (0x20000000) introduce
fragility into this selftest?

Once kind 32 is eventually implemented in the kernel, this test might
spuriously fail. To make the test robust against future additions, should
this use the maximum 7-bit value (127, i.e., 0x7f000000) or another
dynamically guaranteed invalid kind?

[ ... ]

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260414195019.684531-1-alan.maguire@oracle.com?part=6