[v2,1/4] vhost: fix uninitialized vhost queue
Checks
Commit Message
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>
---
lib/librte_vhost/vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 4/2/21 3:03 PM, Jiayu Hu wrote:
> 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>
> ---
> lib/librte_vhost/vhost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index c9d1371..8657bbe 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -609,7 +609,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);
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
@@ -609,7 +609,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);