xref: /linux/tools/testing/selftests/bpf/progs/test_global_func17.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
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 	barrier_var(p);
9 	return p ? (*p = 42) : 0;
10 }
11 
12 const volatile int i;
13 
14 SEC("tc")
15 __failure __msg("Caller passes invalid args into func#1")
16 int global_func17(struct __sk_buff *skb)
17 {
18 	return foo((int *)&i);
19 }
20