diff mbox series

[v3,1/4] vhost: fix uninitialized vhost queue

Message ID 1618909066-114980-2-git-send-email-jiayu.hu@intel.com (mailing list archive)
State Accepted
Delegated to: Maxime Coquelin
Headers show
Series Refactor async vhost control path | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hu, Jiayu April 20, 2021, 8:57 a.m. UTC
This patch allocates vhost queue by rte_zmalloc() to avoid
undefined values.

Fixes: a277c7159876 ("vhost: refactor code structure")
Cc: stable@dpdk.org

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
 lib/librte_vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index a70fe01..ea38cf2 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -608,7 +608,7 @@  alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx)
 		if (dev->virtqueue[i])
-		vq = rte_malloc(NULL, sizeof(struct vhost_virtqueue), 0);
+		vq = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), 0);
 		if (vq == NULL) {
 				"Failed to allocate memory for vring:%u.\n", i);