Skip to contentSkip to conversation

examples/ioat: fix failure check for ioat dequeue

PATCH Applied Ciara Power 3 participants 3 messages Feb 4, 2020 – Feb 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ioat: fix failure check for ioat dequeue

The nb_dq return value from the ioat dequeue is negative in failure cases, however the variable was an unsigned int, causing the condition where nb_dq <= 0 to never be true. This is now cast to a signed int, which will successfully reflect the -1 value to be used in this conditional check.

Coverity issue: 350342
Coverity issue: 350349

Fixes 92c981637ffc ("examples/ioat: handle failure case for ioat dequeue")
---
 examples/ioat/ioatfwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ioat/ioatfwd.c +1 -1
index e9117718f..f460a5c92 100644
@@ -460,7 +460,7 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 				MAX_PKT_BURST, NULL);
 		}
 
-		if (nb_dq <= 0)
+		if ((int32_t) nb_dq <= 0)
 			return;
 
 		if (copy_mode == COPY_MODE_IOAT_NUM)
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ciara Power

The nb_dq return value from the ioat dequeue is negative in failure cases, however the variable was an unsigned int, causing the condition where nb_dq <= 0 to never be true. This is now cast to a signed int, which will successfully reflect the -1 value to be used in this conditional check.

Quoted 7 lines

Coverity issue: 350342
Coverity issue: 350349

Fixes 92c981637ffc ("examples/ioat: handle failure case for ioat dequeue")
Acked-by Bruce Richardson on v1 1/1 Applied
#2 lore raw
In reply to Ciara Power
Quoted 7 lines · Ciara Power

The nb_dq return value from the ioat dequeue is negative in failure cases, however the variable was an unsigned int, causing the condition where nb_dq <= 0 to never be true. This is now cast to a signed int, which will successfully reflect the -1 value to be used in this conditional check.

Quoted 6 lines

Coverity issue: 350342
Coverity issue: 350349

Fixes 92c981637ffc ("examples/ioat: handle failure case for ioat dequeue")

Applied, thanks.

--
David Marchand