On Thu, Sep 25, 2025 at 2:36 AM Mehdi Ben Hadj Khelifa <[email protected]> wrote: > > This series is preparing to add the -Wsign-compare C compilation flag to > the Makefile for bpf selftests as requested by a TODO to help avoid > implicit type conversions and have predictable behavior. > > Changelog: > > Changes from v2: > > -Split up the patch into a patch series as suggested by vivek > > -Include only changes to variable types with no casting by my mentor > david > > -Removed the -Wsign-compare in Makefile to avoid compilation errors > until adding casting for rest of comparisons. > > Link:https://lore.kernel.org/bpf/[email protected]/T/#u > > Changes from v1: > > - Fix CI failed builds where it failed due to do missing .c and > .h files in my patch for working in mainline. > > Link:https://lore.kernel.org/bpf/[email protected]/T/#u > > Mehdi Ben Hadj Khelifa (3): > selftests/bpf: Prepare to add -Wsign-compare for bpf tests > selftests/bpf: Prepare to add -Wsign-compare for bpf tests > selftests/bpf: Prepare to add -Wsign-compare for bpf tests >
I see little value in these transformations. Did we catch any real issue here? All this type casting and replacement is just churn. I certainly don't want such churn in libbpf, and I'd leave BPF selftests as is as well. int vs u64 can have subtle and non-obvious implications for BPF code generation (for no-alu32 variants especially), and I think BPF CI already exposed some of those already. I think we can live without -Wsign-compare just fine. > tools/testing/selftests/bpf/progs/test_global_func11.c | 2 +- > tools/testing/selftests/bpf/progs/test_global_func12.c | 2 +- > tools/testing/selftests/bpf/progs/test_global_func13.c | 2 +- > tools/testing/selftests/bpf/progs/test_global_func9.c | 2 +- > tools/testing/selftests/bpf/progs/test_map_init.c | 2 +- > tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt.c | 2 +- > .../selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c | 2 +- > tools/testing/selftests/bpf/progs/test_skb_ctx.c | 2 +- > tools/testing/selftests/bpf/progs/test_snprintf.c | 2 +- > tools/testing/selftests/bpf/progs/test_sockmap_strp.c | 2 +- > tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 2 +- > tools/testing/selftests/bpf/progs/test_xdp.c | 2 +- > tools/testing/selftests/bpf/progs/test_xdp_dynptr.c | 2 +- > tools/testing/selftests/bpf/progs/test_xdp_loop.c | 2 +- > tools/testing/selftests/bpf/progs/test_xdp_noinline.c | 4 ++-- > tools/testing/selftests/bpf/progs/uprobe_multi.c | 4 ++-- > .../selftests/bpf/progs/uprobe_multi_session_recursive.c | 5 +++-- > .../selftests/bpf/progs/verifier_iterating_callbacks.c | 2 +- > 18 files changed, 22 insertions(+), 21 deletions(-) > > -- > 2.51.0 >

