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
6struct inner {
7 __uint(type, BPF_MAP_TYPE_ARRAY);
8 __type(key, __u32);
9 __type(value, int);
10 __uint(max_entries, 4);
11};
12
13struct {
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
20SEC("xdp")
21int xdp_noop0(struct xdp_md *ctx)
22{
23 return XDP_PASS;
24}
25
26char _license[] SEC("license") = "GPL";
27

source code of linux/tools/testing/selftests/bpf/progs/test_map_in_map_invalid.c