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 36FEBA0A0A for ; Wed, 24 Mar 2021 10:54:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 241984069E; Wed, 24 Mar 2021 10:54:48 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 580AD4067B for ; Wed, 24 Mar 2021 10:54:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616579684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TniLRzDEuBb/nIu4F322TxfW0tfGolrIvzrQiSJ34io=; b=YbQtXRgoA8TotSRwudi3XZ/oEEyTFesbeJL6HDsi0P3TdtQZksjoAK9yjpTlkkGwSM/dfc vdPoaJ8LLtFYa0s2Cll+ceHy3+NtmbycoX32TIKGNQkmTATxru8MPfLf4PY/pHi7LmKymn yUJj5HutXVpYhpMSYLmuOus3mIyqXoQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-561-XlEFqFv9OLWMmILvVQ0U5g-1; Wed, 24 Mar 2021 05:54:42 -0400 X-MC-Unique: XlEFqFv9OLWMmILvVQ0U5g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4351D83DD21; Wed, 24 Mar 2021 09:54:41 +0000 (UTC) Received: from [10.36.110.41] (unknown [10.36.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EAF49CA0; Wed, 24 Mar 2021 09:54:39 +0000 (UTC) To: Marvin Liu , chenbo.xia@intel.com Cc: dev@dpdk.org, stable@dpdk.org References: <20210303072755.82979-1-yong.liu@intel.com> From: Maxime Coquelin Message-ID: <9a853981-06f8-4ab4-f6a8-322ae8629a4b@redhat.com> Date: Wed, 24 Mar 2021 10:54:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210303072755.82979-1-yong.liu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [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" On 3/3/21 8:27 AM, Marvin Liu wrote: > 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", > Reviewed-by: Maxime Coquelin Thanks, Maxime