[dpdk-dev,2/3] ixgbe: prevent array overflow access in vector driver
Commit Message
Switch the order of the conditions in a while loop, so we check the
range of "i" against the max, before using it to index into the array.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -489,7 +489,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
unsigned i = 0;
if (rxq->pkt_first_seg == NULL) {
/* find the first split flag, and only reassemble then*/
- while (!split_flags[i] && i < nb_bufs)
+ while (i < nb_bufs && !split_flags[i])
i++;
if (i == nb_bufs)
return nb_bufs;