xref: /linux/tools/testing/selftests/bpf/progs/test_map_in_map_invalid.c (revision 35758b0032c056cdff3e8f5a70669cb3e2c8d0e4)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Isovalent, Inc. */
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 struct inner {
7 	__uint(type, BPF_MAP_TYPE_ARRAY);
8 	__type(key, __u32);
9 	__type(value, int);
10 	__uint(max_entries, 4);
11 };
12 
13 struct {
14 	__uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
15 	__uint(max_entries, 0); /* This will make map creation to fail */
16 	__type(key, __u32);
17 	__array(values, struct inner);
18 } mim SEC(".maps");
19 
20 SEC("xdp")
21 int xdp_noop0(struct xdp_md *ctx)
22 {
23 	return XDP_PASS;
24 }
25 
26 char _license[] SEC("license") = "GPL";
27