1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc */
4 #include <bpf/bpf_helpers.h>
6 #include "bpf_kfuncs.h"
7 #include "../test_kmods/bpf_testmod_kfunc.h"
10 int kfunc_dynptr_nullable_test1(struct __sk_buff *skb)
12 struct bpf_dynptr data;
14 bpf_dynptr_from_skb(skb, 0, &data);
15 bpf_kfunc_dynptr_test(&data, NULL);
21 int kfunc_dynptr_nullable_test2(struct __sk_buff *skb)
23 struct bpf_dynptr data;
25 bpf_dynptr_from_skb(skb, 0, &data);
26 bpf_kfunc_dynptr_test(&data, &data);
32 __failure __msg("expected pointer to stack or const struct bpf_dynptr")
33 int kfunc_dynptr_nullable_test3(struct __sk_buff *skb)
35 struct bpf_dynptr data;
37 bpf_dynptr_from_skb(skb, 0, &data);
38 bpf_kfunc_dynptr_test(NULL, &data);
43 char _license[] SEC("license") = "GPL";