* [PATCH bpf-next] selftests/bpf: Fix gcc -Wreturn-type error in the tail call subprog test
@ 2026-09-26 11:38 Daniel Borkmann
2026-09-27 19:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2026-09-26 11:38 UTC (permalink / raw)
To: alexei.starovoitov; +Cc: bpf
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: 5add2c64f474 ("selftests/bpf: Add a test for a tail call in a subprogram without an exit")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
tools/testing/selftests/bpf/progs/verifier_cfg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/progs/verifier_cfg.c b/tools/testing/selftests/bpf/progs/verifier_cfg.c
index 07388a922e5b..6379dfc9389b 100644
--- a/tools/testing/selftests/bpf/progs/verifier_cfg.c
+++ b/tools/testing/selftests/bpf/progs/verifier_cfg.c
@@ -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")
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-27 19:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-26 11:38 [PATCH bpf-next] selftests/bpf: Fix gcc -Wreturn-type error in the tail call subprog test Daniel Borkmann
2026-09-27 19:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox