selftests/bpf: Fix erroneous bitmask operation
[platform/kernel/linux-rpi.git] / tools / testing / selftests / bpf / progs / test_global_func17.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 #include <vmlinux.h>
3 #include <bpf/bpf_helpers.h>
4 #include "bpf_misc.h"
5
6 __noinline int foo(int *p)
7 {
8         return p ? (*p = 42) : 0;
9 }
10
11 const volatile int i;
12
13 SEC("tc")
14 __failure __msg("Caller passes invalid args into func#1")
15 int global_func17(struct __sk_buff *skb)
16 {
17         return foo((int *)&i);
18 }