From: Geliang Tang Date: Thu, 23 May 2024 06:50:02 +0000 (+0800) Subject: selftests/bpf: Fix size of map_fd in test_sockmap X-Git-Tag: io_uring-6.11-20240722~71^2~222^2~18 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=dcb681b659f2a0a546752730c9daa92dc6120d52;p=linux-block.git 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 Signed-off-by: Daniel Borkmann Tested-by: Jakub Sitnicki Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/0972529ee01ebf8a8fd2b310bdec90831c94be77.1716446893.git.tanggeliang@kylinos.cn --- diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 64b38a1a1b60..e29f8203bd4f 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c @@ -1285,7 +1285,7 @@ out: 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) {