]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/bpf: Fix up __u16 vlen assumptions
authorAlan Maguire <alan.maguire@oracle.com>
Fri, 17 Apr 2026 14:30:22 +0000 (15:30 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Apr 2026 00:52:48 +0000 (17:52 -0700)
Fix up a few cases where we assume vlen is 16 bits.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Link: https://lore.kernel.org/r/20260417143023.1551481-6-alan.maguire@oracle.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/btf.c
tools/testing/selftests/bpf/prog_tests/btf_dedup_split.c
tools/testing/selftests/bpf/prog_tests/ctx_rewrite.c
tools/testing/selftests/bpf/test_progs.c

index 0cc347e32db37f9b43b50dd9ee7f1053cfbc4078..a9de328a869768ca1e0721b242785b9a057ba1f4 100644 (file)
@@ -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);
 
        switch (kind) {
index 5bc15bb6b7ce64540c219841c0e2697289ae1fe0..6bc31236805cefb6920ea00a093e15209fbe315c 100644 (file)
@@ -487,9 +487,8 @@ static void test_split_module(void)
        for (i = 0; i < ARRAY_SIZE(mod_funcs); i++) {
                const struct btf_param *p;
                const struct btf_type *t;
-               __u16 vlen;
+               __u32 vlen, j;
                __u32 id;
-               int j;
 
                id = btf__find_by_name_kind(btf1, mod_funcs[i], BTF_KIND_FUNC);
                if (!ASSERT_GE(id, nr_base_types, "func_id"))
index 469e92869523fa7b22ca78786bb09aa7677b5c00..5064aeb8fe670e9409d43e0b1393b2425862a9ea 100644 (file)
@@ -253,8 +253,7 @@ static int find_field_offset_aux(struct btf *btf, int btf_id, char *field_name,
 {
        const struct btf_type *type = btf__type_by_id(btf, btf_id);
        const struct btf_member *m;
-       __u16 mnum;
-       int i;
+       __u32 mnum, i;
 
        if (!type) {
                PRINT_FAIL("Can't find btf_type for id %d\n", btf_id);
index 7fe16b5131b1a6903cf30895efeb8571bf67f350..cc14b13e23fe18734dcc86fbc4757a08fb81d0fb 100644 (file)
@@ -1257,7 +1257,7 @@ int get_bpf_max_tramp_links_from(struct btf *btf)
        const struct btf_type *t;
        __u32 i, type_cnt;
        const char *name;
-       __u16 j, vlen;
+       __u32 j, vlen;
 
        for (i = 1, type_cnt = btf__type_cnt(btf); i < type_cnt; i++) {
                t = btf__type_by_id(btf, i);