selftests/bpf: Fix size of map_fd in test_sockmap

The array size of map_fd[] is 9, not 8. This patch changes it as a more
general form: ARRAY_SIZE(map_fd).

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/0972529ee01ebf8a8fd2b310bdec90831c94be77.1716446893.git.tanggeliang@kylinos.cn
This commit is contained in:
Geliang Tang 2024-05-23 14:50:02 +08:00 committed by Daniel Borkmann
parent 467a0c79b5
commit dcb681b659

View File

@ -1285,7 +1285,7 @@ static int run_options(struct sockmap_options *options, int cg_fd, int test)
bpf_link__detach(links[i]);
}
for (i = 0; i < 8; i++) {
for (i = 0; i < ARRAY_SIZE(map_fd); i++) {
key = next_key = 0;
bpf_map_update_elem(map_fd[i], &key, &zero, BPF_ANY);
while (bpf_map_get_next_key(map_fd[i], &key, &next_key) == 0) {