From patchwork Tue Apr 20 08:57:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hu, Jiayu" X-Patchwork-Id: 91807 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41A6BA0547; Tue, 20 Apr 2021 04:28:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3A1C4159F; Tue, 20 Apr 2021 04:28:43 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3D9C940688; Tue, 20 Apr 2021 04:28:39 +0200 (CEST) IronPort-SDR: dWoRo5oWjuCsHtThMt9WuaKPZIi4vtZSKEkcZ7/zVDhCBGSBT1A+7wl9ZEA1oKT0uF3VN7F8U7 Yvw6xokekG4Q== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="256741029" X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="256741029" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 19:28:38 -0700 IronPort-SDR: iTK1ZqsJdASwFR9eqBaawBS6FVGwEG/iGnpF0ZlBEGpx2EQo0WHJYWgUVYN1HUkUR7LbKk1ett rzskcsGYFQ6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="426739848" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.118.193]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2021 19:28:35 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, yinan.wang@intel.com, sunil.pai.g@intel.com, cheng1.jiang@intel.com, jiayu.hu@intel.com, stable@dpdk.org Date: Tue, 20 Apr 2021 04:57:43 -0400 Message-Id: <1618909066-114980-2-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618909066-114980-1-git-send-email-jiayu.hu@intel.com> References: <1617368642-131298-1-git-send-email-jiayu.hu@intel.com> <1618909066-114980-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH v3 1/4] vhost: fix uninitialized vhost queue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Maxime Coquelin Tested-by: Yinan Wang --- 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 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]) 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);