Skip to content

Commit

Permalink
vhost: fix queue initialization
Browse files Browse the repository at this point in the history
[ upstream commit 678a91e ]

This patch allocates vhost queue by rte_zmalloc() to avoid
undefined values.

Fixes: a277c71 ("vhost: refactor code structure")

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>
  • Loading branch information
humasama authored and steevenlee committed Jun 8, 2021
1 parent 351bc34 commit b0a7aab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/librte_vhost/vhost.c
Expand Up @@ -598,7 +598,7 @@ alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx)
if (dev->virtqueue[i])
continue;

vq = rte_malloc(NULL, sizeof(struct vhost_virtqueue), 0);
vq = rte_zmalloc(NULL, sizeof(struct vhost_virtqueue), 0);
if (vq == NULL) {
VHOST_LOG_CONFIG(ERR,
"Failed to allocate memory for vring:%u.\n", i);
Expand Down

0 comments on commit b0a7aab

Please sign in to comment.