summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_global_func17.c
blob: 5de44b09e8ec170b946dd8a069c8b356c0a9398f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SPDX-License-Identifier: GPL-2.0-only
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include "bpf_misc.h"

__noinline int foo(int *p)
{
	barrier_var(p);
	return p ? (*p = 42) : 0;
}

const volatile int i;

SEC("tc")
__failure __msg("Caller passes invalid args into func#1")
int global_func17(struct __sk_buff *skb)
{
	return foo((int *)&i);
}