examples/ioat: handle failure case for ioat dequeue

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: 2328542ed8 ("examples/ioat: add rawdev copy mode")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Bruce Richardson 2019-11-25 15:23:03 +00:00 committed by David Marchand
parent 2808a12cc0
commit 92c981637f

View 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)