Re: [PATCH RESEND v3 3/3] selftests/bpf: Add supplementary tests for bpf_kptr_xchg

From: bot+bpf-ci

Date: Mon Feb 02 2026 - 01:22:40 EST


> diff --git a/tools/testing/selftests/bpf/progs/rbtree_search_kptr.c b/tools/testing/selftests/bpf/progs/rbtree_search_kptr.c
> new file mode 100644
> index 0000000000..1345c7f441
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/rbtree_search_kptr.c

[ ... ]

> + bpf_spin_unlock(&lock);
> +
> + rb_n = NULL;
> + while (rb_n && can_loop) {

rb_n is set to NULL on the line above, so the while condition
(rb_n && can_loop) is immediately false and the loop body is skipped.

Should this be something like:

rb_n = (void *)1;
while (rb_n && can_loop) {
bpf_spin_lock(&lock);
rb_n = bpf_rbtree_first(&root);

to ensure the cleanup loop actually runs?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21579259592

AI-authorship-score: low
AI-authorship-explanation: The code contains a simple human error (dead loop due to typo) that an AI would be unlikely to produce; the pattern and style match existing human-written selftests in the same directory.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Dead code in cleanup loop prevents node removal in a selftest; test passes but does not perform the cleanup described in the commit message.