[dpdk-dev] virtio: fixed possible data loss in function virtio_recv_mergeable_pkts
Commit Message
Variable rcv_cnt declared in function virtio_recv_mergeable_pkts was of
type uint32_t. It was used by virtqueue_dequeue_burst_rx function, which
expects argument of type uint16_t. Changed rcv_cnt variable type to
uint16_t to prevent possible data loss. Issue found with static code
analysis tool.
Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
lib/librte_pmd_virtio/virtio_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -602,7 +602,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,
/*
* Get extra segments for current uncompleted packet.
*/
- uint32_t rcv_cnt =
+ uint16_t rcv_cnt =
RTE_MIN(seg_res, RTE_DIM(rcv_pkts));
if (likely(VIRTQUEUE_NUSED(rxvq) >= rcv_cnt)) {
uint32_t rx_num =