From: Ferruh Yigit Date: Sun, 28 Oct 2018 01:08:46 +0000 (+0000) Subject: vhost: fix possible out of bound access X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7b178300accc661b7bbd47da93380106378dba1c;p=dpdk.git vhost: fix possible out of bound access Fixes: d7280c9fffcb ("vhost: support selective datapath") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c index c2c5dff1d4..e7d849ee0f 100644 --- a/lib/librte_vhost/vdpa.c +++ b/lib/librte_vhost/vdpa.c @@ -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);