From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E7FCC433ED for ; Wed, 7 Apr 2021 03:26:57 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id BF62A6139B for ; Wed, 7 Apr 2021 03:26:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF62A6139B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 137A6140FC7; Wed, 7 Apr 2021 05:26:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 26E0D407FF; Wed, 7 Apr 2021 05:26:49 +0200 (CEST) IronPort-SDR: 19z3HhEyqh7Ibm6dPEvY+tWWIb/VBdV9KeqOTvMq6YgNdkEv9GaY25iEqIe+yAXhLK7VqLGEQS u4bVDO2NpaIw== X-IronPort-AV: E=McAfee;i="6000,8403,9946"; a="254545016" X-IronPort-AV: E=Sophos;i="5.82,201,1613462400"; d="scan'208";a="254545016" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2021 20:26:48 -0700 IronPort-SDR: NJcMm6bTqKg+l9/PtCNiAgSJ0V6oE66IcS9v6hSqcC44RTvimfEii4lzj0oXuYpwloT8vQ/WzJ FA7QxmeZUDzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,201,1613462400"; d="scan'208";a="415076139" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.108]) by fmsmga008.fm.intel.com with ESMTP; 06 Apr 2021 20:26:46 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, Marvin Liu , stable@dpdk.org Date: Wed, 7 Apr 2021 11:25:16 +0800 Message-Id: <20210407032516.79091-2-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210407032516.79091-1-yong.liu@intel.com> References: <20210407032516.79091-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH 2/2] vhost: fix async enqueue accessing uninitialized variables 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 fixs coverity issue in async enqueue function by adding initialization step before using temporary virtio header. Coverity issue: 366123 Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Cc: stable@dpdk.org Signed-off-by: Marvin Liu diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 48b013a9b4..ff39878609 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -986,9 +986,10 @@ async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, hdr_mbuf = m; hdr_addr = buf_addr; - if (unlikely(buf_len < dev->vhost_hlen)) + if (unlikely(buf_len < dev->vhost_hlen)) { + memset(&tmp_hdr, 0, sizeof(struct virtio_net_hdr_mrg_rxbuf)); hdr = &tmp_hdr; - else + } else hdr = (struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)hdr_addr; VHOST_LOG_DATA(DEBUG, "(%d) RX: num merge buffers %d\n", -- 2.17.1