selftests/bpf: Fix gcc -Wreturn-type error in the tail call subprog test
Subsystems (3)
Daniel Borkmann
maintainerPATCH 1/1 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
--- tools/testing/selftests/bpf/progs/verifier_cfg.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/progs/verifier_cfg.c +1 -0
@@ -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" )
Signature · 1 line
2.43.0
This patch was applied to bpf/bpf-next.git (master) by Kumar Kartikeya Dwivedi <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Kumar Kartikeya Dwivedi <[email protected]>:
Quoted 8 lines · On Sat, 26 Sep 2026 13:38:35 +0200 you wrote:
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][...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Fix gcc -Wreturn-type error in the tail call subprog test
https://git.kernel.org/bpf/bpf-next/c/ea9358e1270a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html