xref: /linux/tools/testing/selftests/bpf/progs/test_global_func17.c (revision 69bfec7548f4c1595bac0e3ddfc0458a5af31f4c)
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 }
19