Skip to content

Commit fe6e9a7

Browse files
bastien-curutchetKernel Patches Daemon
authored andcommitted
selftests/bpf: test_xsk: Initialize bitmap before use
bitmap is used before being initialized. Initialize it to zero before using it. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 5444f68 commit fe6e9a7

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
@@ -1079,6 +1079,8 @@ static int receive_pkts(struct test_spec *test)
10791079
u32 sock_num = 0;
10801080
int res, ret;
10811081

1082+
bitmap_zero(bitmap, test->nb_sockets);
1083+
10821084
ret = gettimeofday(&tv_now, NULL);
10831085
if (ret)
10841086
exit_with_error(errno);
@@ -1269,6 +1271,8 @@ static int send_pkts(struct test_spec *test, struct ifobject *ifobject)
12691271
DECLARE_BITMAP(bitmap, test->nb_sockets);
12701272
u32 i, ret;
12711273

1274+
bitmap_zero(bitmap, test->nb_sockets);
1275+
12721276
while (!(all_packets_sent(test, bitmap))) {
12731277
for (i = 0; i < test->nb_sockets; i++) {
12741278
struct pkt_stream *pkt_stream;

0 commit comments

Comments
 (0)