]> Git Repo - J-linux.git/commitdiff
selftests/bpf: Fix build error with llvm 19
authorAlexei Starovoitov <[email protected]>
Sat, 16 Nov 2024 18:56:17 +0000 (10:56 -0800)
committerAlexei Starovoitov <[email protected]>
Sat, 16 Nov 2024 18:56:17 +0000 (10:56 -0800)
llvm 19 fails to compile arena self test:
CLNG-BPF [test_progs] verifier_arena_large.bpf.o
progs/verifier_arena_large.c:90:24: error: unsupported signed division, please convert to unsigned div/mod.
   90 |                 pg_idx = (pg - base) / PAGE_SIZE;

Though llvm <= 18 and llvm >= 20 don't have this issue,
fix the test to avoid the build error.

Reported-by: Jiri Olsa <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
tools/testing/selftests/bpf/progs/verifier_arena_large.c

index 8a9af79db884937ec0a2097b3eaf92f558ab38ec..f94f30cf1bb80f64552318e074fe23cb04e679a0 100644 (file)
@@ -87,7 +87,7 @@ __noinline int alloc_pages(int page_cnt, int pages_atonce, bool first_pass,
                                           NUMA_NO_NODE, 0);
                if (!pg)
                        return step;
-               pg_idx = (pg - base) / PAGE_SIZE;
+               pg_idx = (unsigned long) (pg - base) / PAGE_SIZE;
                if (first_pass) {
                        /* Pages must be allocated sequentially */
                        if (pg_idx != i)
This page took 0.046143 seconds and 4 git commands to generate.