Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix prog numbers in test_sockmap

bpf_prog5 and bpf_prog7 are removed from progs/test_sockmap_kern.h in
commit d79a32129b21 ("bpf: Selftests, remove prints from sockmap tests"),
now there are only 9 progs in it, not 11:

SEC("sk_skb1")
int bpf_prog1(struct __sk_buff *skb)
SEC("sk_skb2")
int bpf_prog2(struct __sk_buff *skb)
SEC("sk_skb3")
int bpf_prog3(struct __sk_buff *skb)
SEC("sockops")
int bpf_sockmap(struct bpf_sock_ops *skops)
SEC("sk_msg1")
int bpf_prog4(struct sk_msg_md *msg)
SEC("sk_msg2")
int bpf_prog6(struct sk_msg_md *msg)
SEC("sk_msg3")
int bpf_prog8(struct sk_msg_md *msg)
SEC("sk_msg4")
int bpf_prog9(struct sk_msg_md *msg)
SEC("sk_msg5")
int bpf_prog10(struct sk_msg_md *msg)

This patch updates the array sizes of prog_fd[], prog_attach_type[] and
prog_type[] from 11 to 9 accordingly.

Fixes: d79a32129b21 ("bpf: Selftests, remove prints from sockmap tests")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/9c10d9f974f07fcb354a43a8eca67acb2fafc587.1715926605.git.tanggeliang@kylinos.cn

authored by

Geliang Tang and committed by
Andrii Nakryiko
6c8d7598 1b0215a3

+1 -5
+1 -5
tools/testing/selftests/bpf/test_sockmap.c
··· 63 63 int failed; 64 64 int map_fd[9]; 65 65 struct bpf_map *maps[9]; 66 - int prog_fd[11]; 66 + int prog_fd[9]; 67 67 68 68 int txmsg_pass; 69 69 int txmsg_redir; ··· 1793 1793 BPF_SK_MSG_VERDICT, 1794 1794 BPF_SK_MSG_VERDICT, 1795 1795 BPF_SK_MSG_VERDICT, 1796 - BPF_SK_MSG_VERDICT, 1797 - BPF_SK_MSG_VERDICT, 1798 1796 }; 1799 1797 1800 1798 int prog_type[] = { ··· 1800 1802 BPF_PROG_TYPE_SK_SKB, 1801 1803 BPF_PROG_TYPE_SK_SKB, 1802 1804 BPF_PROG_TYPE_SOCK_OPS, 1803 - BPF_PROG_TYPE_SK_MSG, 1804 - BPF_PROG_TYPE_SK_MSG, 1805 1805 BPF_PROG_TYPE_SK_MSG, 1806 1806 BPF_PROG_TYPE_SK_MSG, 1807 1807 BPF_PROG_TYPE_SK_MSG,