summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>2025-10-31 09:04:38 +0100
committerAlexei Starovoitov <ast@kernel.org>2025-10-31 09:24:38 -0700
commit2233ef8bba81e02e8fee6300a81dcf389aa17c58 (patch)
tree8b94686797c98a6639c89482d8dd6d0a8e0869ef
parent3ab77f35a75eb236956c1e8ba8494ef18a75eae0 (diff)
selftests/bpf: test_xsk: Initialize bitmap before use
bitmap is used before being initialized. Initialize it to zero before using it. Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com> Link: https://lore.kernel.org/r/20251031-xsk-v7-2-39fe486593a3@bootlin.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r--tools/testing/selftests/bpf/test_xsk.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftests/bpf/test_xsk.c
index 02250f29f994..679491b6b9dd 100644
--- a/tools/testing/selftests/bpf/test_xsk.c
+++ b/tools/testing/selftests/bpf/test_xsk.c
@@ -1069,6 +1069,8 @@ static int receive_pkts(struct test_spec *test)
u32 sock_num = 0;
int res, ret;
+ bitmap_zero(bitmap, test->nb_sockets);
+
ret = gettimeofday(&tv_now, NULL);
if (ret)
exit_with_error(errno);
@@ -1259,6 +1261,8 @@ static int send_pkts(struct test_spec *test, struct ifobject *ifobject)
DECLARE_BITMAP(bitmap, test->nb_sockets);
u32 i, ret;
+ bitmap_zero(bitmap, test->nb_sockets);
+
while (!(all_packets_sent(test, bitmap))) {
for (i = 0; i < test->nb_sockets; i++) {
struct pkt_stream *pkt_stream;