vhost: fix possible out of bound access

Fixes: d7280c9fff ("vhost: support selective datapath")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Ferruh Yigit 2018-10-28 01:08:46 +00:00 committed by Thomas Monjalon
parent c8b506e4b6
commit 7b178300ac

View File

@ -63,6 +63,9 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,
break;
}
if (i == MAX_VHOST_DEVICE)
return -1;
sprintf(device_name, "vdpa-dev-%d", i);
dev = rte_zmalloc(device_name, sizeof(struct rte_vdpa_device),
RTE_CACHE_LINE_SIZE);