net/vmxnet3: fix unintentional integer overflow
authorSebastian Basierski <sebastianx.basierski@intel.com>
Tue, 19 Sep 2017 11:47:58 +0000 (13:47 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:49 +0000 (02:49 +0200)
Fixed overflow by casting txq->cmd_ring.next2fill to uint64_t type.

Coverity issue: 143457

Fixes: 01fef6e3c181 ("net/vmxnet3: allow variable length Tx data ring")
Cc: stable@dpdk.org
Signed-off-by: Sebastian Basierski <sebastianx.basierski@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/vmxnet3/vmxnet3_rxtx.c

index 9861d35..d08f5eb 100644 (file)
@@ -504,8 +504,9 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                         */
                        gdesc = txq->cmd_ring.base + txq->cmd_ring.next2fill;
                        if (copy_size) {
-                               uint64 offset = txq->cmd_ring.next2fill *
-                                               txq->txdata_desc_size;
+                               uint64 offset =
+                                       (uint64)txq->cmd_ring.next2fill *
+                                                       txq->txdata_desc_size;
                                gdesc->txd.addr =
                                        rte_cpu_to_le_64(txq->data_ring.basePA +
                                                         offset);