Commit dcb681b6 authored by Geliang Tang's avatar Geliang Tang Committed by Daniel Borkmann

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: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Tested-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/0972529ee01ebf8a8fd2b310bdec90831c94be77.1716446893.git.tanggeliang@kylinos.cn
parent 467a0c79
...@@ -1285,7 +1285,7 @@ static int run_options(struct sockmap_options *options, int cg_fd, int test) ...@@ -1285,7 +1285,7 @@ static int run_options(struct sockmap_options *options, int cg_fd, int test)
bpf_link__detach(links[i]); bpf_link__detach(links[i]);
} }
for (i = 0; i < 8; i++) { for (i = 0; i < ARRAY_SIZE(map_fd); i++) {
key = next_key = 0; key = next_key = 0;
bpf_map_update_elem(map_fd[i], &key, &zero, BPF_ANY); bpf_map_update_elem(map_fd[i], &key, &zero, BPF_ANY);
while (bpf_map_get_next_key(map_fd[i], &key, &next_key) == 0) { while (bpf_map_get_next_key(map_fd[i], &key, &next_key) == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment