xref: /linux/tools/testing/selftests/bpf/progs/test_global_func17.c (revision 8a922b7728a93d837954315c98b84f6b78de0c4f)
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