xref: /linux/tools/testing/selftests/bpf/progs/test_global_func14.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0-only
2 #include <stddef.h>
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_misc.h"
6 
7 struct S;
8 
9 __noinline int foo(const struct S *s)
10 {
11 	if (s)
12 		return bpf_get_prandom_u32() < *(const int *) s;
13 
14 	return 0;
15 }
16 
17 SEC("cgroup_skb/ingress")
18 __failure __msg("reference type('FWD S') size cannot be determined")
19 int global_func14(struct __sk_buff *skb)
20 {
21 
22 	return foo(NULL);
23 }
24