examples/vhost: fix potentially overflowing expression

Change the type of buff_idx from uint64_t to uint32_t to fix coverity
issue.

Coverity issue: 366264
Fixes: a68ba8e0a6 ("examples/vhost: refactor vhost data path")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Cheng Jiang 2021-02-02 07:24:21 +00:00 committed by Ferruh Yigit
parent d4d4c6fed6
commit ee6e451f14

View File

@ -861,7 +861,7 @@ static __rte_always_inline void
drain_vhost(struct vhost_dev *vdev)
{
uint16_t ret;
uint64_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
uint32_t buff_idx = rte_lcore_id() * MAX_VHOST_DEVICE + vdev->vid;
uint16_t nr_xmit = vhost_txbuff[buff_idx]->len;
struct rte_mbuf **m = vhost_txbuff[buff_idx]->m_table;