OSDN Git Service

selftests/bpf: Fix u32 variable compared with less than zero
authorKang Minchul <tegongkang@gmail.com>
Sat, 5 Nov 2022 18:36:56 +0000 (03:36 +0900)
committerMartin KaFai Lau <martin.lau@kernel.org>
Tue, 8 Nov 2022 00:53:50 +0000 (16:53 -0800)
Variable ret is compared with less than zero even though it was set as u32.
So u32 to int conversion is needed.

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/r/20221105183656.86077-1-tegongkang@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/xskxceiver.c

index 681a5db..162d3a5 100644 (file)
@@ -1006,7 +1006,8 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd
 {
        struct xsk_socket_info *xsk = ifobject->xsk;
        bool use_poll = ifobject->use_poll;
-       u32 i, idx = 0, ret, valid_pkts = 0;
+       u32 i, idx = 0, valid_pkts = 0;
+       int ret;
 
        while (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) < BATCH_SIZE) {
                if (use_poll) {