@@ -49,8 +49,7 @@
int test##_missing_lock_##op(void *ctx) \
{ \
INIT; \
- void (*p)(void *) = (void *)&bpf_list_##op; \
- p(hexpr); \
+ bpf_list_##op(hexpr); \
return 0; \
}
@@ -96,9 +95,8 @@ CHECK(inner_map, push_back, &iv->head, &f->node2);
int test##_incorrect_lock_##op(void *ctx) \
{ \
INIT; \
- void (*p)(void *) = (void *)&bpf_list_##op; \
bpf_spin_lock(lexpr); \
- p(hexpr); \
+ bpf_list_##op(hexpr); \
return 0; \
}
@@ -576,7 +574,7 @@ int incorrect_head_off2(void *ctx)
}
static __always_inline
-int pop_ptr_off(void *(*op)(void *head))
+int pop_ptr_off(bool pop_front)
{
struct {
struct bpf_list_head head __contains(foo, node2);
@@ -588,7 +586,10 @@ int pop_ptr_off(void *(*op)(void *head))
if (!p)
return 0;
bpf_spin_lock(&p->lock);
- n = op(&p->head);
+ if (pop_front)
+ n = bpf_list_pop_front(&p->head);
+ else
+ n = bpf_list_pop_back(&p->head);
bpf_spin_unlock(&p->lock);
if (!n)
@@ -600,13 +601,13 @@ int pop_ptr_off(void *(*op)(void *head))
SEC("?tc")
int pop_front_off(void *ctx)
{
- return pop_ptr_off((void *)bpf_list_pop_front);
+ return pop_ptr_off(true);
}
SEC("?tc")
int pop_back_off(void *ctx)
{
- return pop_ptr_off((void *)bpf_list_pop_back);
+ return pop_ptr_off(false);
}
SEC("?tc")
Since a hidden arguement is added to bpf list remove kfuncs, and bpf_list_pop_back/front are macrofied, we modify selftests so that it can be compiled. Signed-off-by: Amery Hung <amery.hung@bytedance.com> --- .../selftests/bpf/progs/linked_list_fail.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)