DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: fixed possible data loss in function virtio_recv_mergeable_pkts
@ 2015-02-20 16:13 Maciej Gajdzica
  0 siblings, 0 replies; only message in thread
From: Maciej Gajdzica @ 2015-02-20 16:13 UTC (permalink / raw)
  To: dev

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

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 468e978..8fcad9b 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -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 =
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-20 16:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 16:13 [dpdk-dev] [PATCH] virtio: fixed possible data loss in function virtio_recv_mergeable_pkts Maciej Gajdzica

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).