From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C8E6A0561 for ; Wed, 3 Mar 2021 08:28:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D593406B4; Wed, 3 Mar 2021 08:28:56 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 634A74067B; Wed, 3 Mar 2021 08:28:53 +0100 (CET) IronPort-SDR: +38Kv9HMUXOA6Q90S2ORJqv0vxwobrBMif/E+QBhBcYt4k3su/fJ6jKx6WMXZYckB0BBnWWsbd QhdINRdbnLsg== X-IronPort-AV: E=McAfee;i="6000,8403,9911"; a="187243587" X-IronPort-AV: E=Sophos;i="5.81,219,1610438400"; d="scan'208";a="187243587" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2021 23:28:52 -0800 IronPort-SDR: fk+zWldeglpr7RHhXRTvt16ti5LuxmP1gSGUaN0vTYwTPr9MNIj2uUjP7i47eccucjfiH1Oi97 hKrbij+pxZGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,219,1610438400"; d="scan'208";a="407118248" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.108]) by orsmga008.jf.intel.com with ESMTP; 02 Mar 2021 23:28:50 -0800 From: Marvin Liu To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, Marvin Liu , stable@dpdk.org Date: Wed, 3 Mar 2021 15:27:55 +0800 Message-Id: <20210303072755.82979-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] vhost: fix accessing uninitialized variables X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" This patch fixs coverity issue by adding initialization step before using temporary virtio header. Coverity issue: 366181, 366123 Fixes: fb3815cc614d ("vhost: handle virtually non-contiguous buffers in Rx-mrg") 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 583bf379c6..fe464b3088 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -808,9 +808,10 @@ copy_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