summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFerruh Yigit <ferruh.yigit@intel.com>2018-10-28 01:08:46 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-06 01:14:23 +0100
commit7b178300accc661b7bbd47da93380106378dba1c (patch)
tree5fbbb903774e6b8e1c63fb82d255b9940be85b46 /lib
parentc8b506e4b661c23264debc66f52c7270f903a00e (diff)
downloaddpdk-7b178300accc661b7bbd47da93380106378dba1c.zip
dpdk-7b178300accc661b7bbd47da93380106378dba1c.tar.gz
dpdk-7b178300accc661b7bbd47da93380106378dba1c.tar.xz
vhost: fix possible out of bound access
Fixes: d7280c9fffcb ("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>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_vhost/vdpa.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c
index c2c5dff..e7d849e 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);