Skip to content

Commit 2233ef8

Browse files
bastien-curutchetAlexei Starovoitov
authored andcommitted
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 <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 3ab77f3 commit 2233ef8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/bpf/test_xsk.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,8 @@ static int receive_pkts(struct test_spec *test)
10691069
u32 sock_num = 0;
10701070
int res, ret;
10711071

1072+
bitmap_zero(bitmap, test->nb_sockets);
1073+
10721074
ret = gettimeofday(&tv_now, NULL);
10731075
if (ret)
10741076
exit_with_error(errno);
@@ -1259,6 +1261,8 @@ static int send_pkts(struct test_spec *test, struct ifobject *ifobject)
12591261
DECLARE_BITMAP(bitmap, test->nb_sockets);
12601262
u32 i, ret;
12611263

1264+
bitmap_zero(bitmap, test->nb_sockets);
1265+
12621266
while (!(all_packets_sent(test, bitmap))) {
12631267
for (i = 0; i < test->nb_sockets; i++) {
12641268
struct pkt_stream *pkt_stream;

0 commit comments

Comments
 (0)