]> Git Repo - linux.git/blob - tools/testing/selftests/bpf/progs/test_global_func12.c
Linux 6.14-rc3
[linux.git] / tools / testing / selftests / bpf / progs / test_global_func12.c
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         int x;
9 };
10
11 __noinline int foo(const struct S *s)
12 {
13         return bpf_get_prandom_u32() < s->x;
14 }
15
16 SEC("cgroup_skb/ingress")
17 __failure __msg("invalid mem access 'mem_or_null'")
18 int global_func12(struct __sk_buff *skb)
19 {
20         const struct S s = {.x = skb->len };
21
22         foo(&s);
23
24         return 1;
25 }
This page took 0.031765 seconds and 4 git commands to generate.