examples/ioat: handle failure case for ioat dequeue
authorBruce Richardson <bruce.richardson@intel.com>
Mon, 25 Nov 2019 15:23:03 +0000 (15:23 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 26 Nov 2019 16:26:08 +0000 (17:26 +0100)
On a failure with the ioat dequeue, -1 is returned, which was not properly
handled. This could lead to out-of-bounds reads on a later loop which
assumed a positive return value. Fix this by treating an error as though a
dequeue of 0 had been encountered.

Coverity issue: 350342
Coverity issue: 350349
Fixes: 2328542ed84e ("examples/ioat: add rawdev copy mode")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
examples/ioat/ioatfwd.c

index 5e623a4..9fc033b 100644 (file)
@@ -457,7 +457,7 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
                                MAX_PKT_BURST, NULL);
                }
 
-               if (nb_dq == 0)
+               if (nb_dq <= 0)
                        return;
 
                if (copy_mode == COPY_MODE_IOAT_NUM)