selftests/bpf: Fix gcc -Wreturn-type error in the tail call subprog test

gcc's C front end warns for a static function returning non-void that has
no return statement at all, regardless of the for (;;) {} it ends in, and
BPF CI builds test_progs-bpf_gcc with -Werror:

  progs/verifier_cfg.c: In function 'tail_call_or_throw_subprog':
  error: no return statement in function returning non-void [-Werror=return-type]

Add an unreachable return after the loop.

  # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t verifier_cfg
  [...]
  #626/21  verifier_cfg/tail call in a subprogram without an exit:OK
  #626     verifier_cfg:OK
  Summary: 1/21 PASSED, 0 SKIPPED, 0/0 FAILED

Fixes: 5add2c64f4 ("selftests/bpf: Add a test for a tail call in a subprogram without an exit")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20260926113835.1193471-1-daniel@iogearbox.net
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
This commit is contained in:
Daniel Borkmann 2026-09-26 13:38:35 +02:00 committed by Kumar Kartikeya Dwivedi
parent 12aa64bbce
commit ea9358e127
No known key found for this signature in database
GPG Key ID: 472D377B63542F83

View File

@ -196,6 +196,7 @@ static int tail_call_or_throw_subprog(void *ctx)
bpf_tail_call(ctx, &map_array, idx);
bpf_throw(0);
for (;;) {}
return 0;
}
SEC("tc")