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 D6037A0562 for ; Fri, 19 Mar 2021 10:50:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BADA1140FD2; Fri, 19 Mar 2021 10:50:55 +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 D01C1140FD0 for ; Fri, 19 Mar 2021 10:50:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616147453; 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=KkSWGIA2KeWrPOTwbsk3BpT9+Fhrva0xJ0L/hdUOwxg=; b=H3aX0tMEPtexeEuOWP53Xn8epd3h6cgGCgKiZ7vJdAO1etS36P0vA9P1UJdsOrtBiDEKHz FenVhmrkJAFkFUIjtaFGz2HFPLyMe3VMdP/peBlF7g8zm7kVshquPu5WPEuCP0IzeTBLsI o/+2uGYXNWFW1HcoeL6H/UJwuKJCIfU= 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-337-DUXVElQCOBWfuwMptLlrfg-1; Fri, 19 Mar 2021 05:50:49 -0400 X-MC-Unique: DUXVElQCOBWfuwMptLlrfg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96D6710866AF; Fri, 19 Mar 2021 09:50:47 +0000 (UTC) Received: from [10.36.110.37] (unknown [10.36.110.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 722B9627DD; Fri, 19 Mar 2021 09:50:46 +0000 (UTC) To: Chenbo Xia , dev@dpdk.org Cc: stable@dpdk.org References: <20210219024011.77233-1-chenbo.xia@intel.com> From: Maxime Coquelin Message-ID: <10e76c6b-f3be-e86a-f72b-8bb63510863d@redhat.com> Date: Fri, 19 Mar 2021 10:50:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210219024011.77233-1-chenbo.xia@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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] examples/vhost: fix unchecked return value 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 2/19/21 3:40 AM, Chenbo Xia wrote: > This patch fixes unchecked return value for rte_vhost_get_mem_table(), > which is reported by coverity. > > Coverity issue: 364233 > Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs") > Cc: stable@dpdk.org > > Signed-off-by: Chenbo Xia > --- > examples/vhost/virtio_net.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c > index 64bf3d19ff..9064fc3a82 100644 > --- a/examples/vhost/virtio_net.c > +++ b/examples/vhost/virtio_net.c > @@ -23,6 +23,7 @@ vs_vhost_net_setup(struct vhost_dev *dev) > uint16_t i; > int vid = dev->vid; > struct vhost_queue *queue; > + int ret; > > RTE_LOG(INFO, VHOST_CONFIG, > "setting builtin vhost-user net driver\n"); > @@ -33,7 +34,12 @@ vs_vhost_net_setup(struct vhost_dev *dev) > else > dev->hdr_len = sizeof(struct virtio_net_hdr); > > - rte_vhost_get_mem_table(vid, &dev->mem); > + ret = rte_vhost_get_mem_table(vid, &dev->mem); > + if (ret < 0) { > + RTE_LOG(ERR, VHOST_CONFIG, "Failed to get " > + "VM memory layout for device(%d)\n", vid); > + return; > + } > > dev->nr_vrings = rte_vhost_get_vring_num(vid); > for (i = 0; i < dev->nr_vrings; i++) { > Reviewed-by: Maxime Coquelin Thanks, Maxime