From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8AB13A04B3; Mon, 16 Dec 2019 06:33:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4F4811C0BE; Mon, 16 Dec 2019 06:33:01 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 1BD7E1C08E; Mon, 16 Dec 2019 06:32:58 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Dec 2019 21:32:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,320,1571727600"; d="scan'208";a="204998424" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by orsmga007.jf.intel.com with ESMTP; 15 Dec 2019 21:32:56 -0800 Date: Mon, 16 Dec 2019 13:33:15 +0800 From: Tiwei Bie To: Yunjian Wang Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, xudingke@huawei.com, stable@dpdk.org Message-ID: <20191216053315.GA133010@___> References: <1576458359-13848-1-git-send-email-wangyunjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1576458359-13848-1-git-send-email-wangyunjian@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/vhost: fix return value of vhost creates not checked X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On Mon, Dec 16, 2019 at 09:05:59AM +0800, Yunjian Wang wrote: > The function eth_dev_vhost_create() could return errors, > the return value need to be checked. > > Fixes: ee584e9710b9 ("vhost: add driver on top of the library") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > drivers/net/vhost/rte_eth_vhost.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c > index 46f01a7..7e4faf2 100644 > --- a/drivers/net/vhost/rte_eth_vhost.c > +++ b/drivers/net/vhost/rte_eth_vhost.c > @@ -1455,8 +1455,10 @@ struct vhost_xstats_name_off { > if (dev->device.numa_node == SOCKET_ID_ANY) > dev->device.numa_node = rte_socket_id(); > > - eth_dev_vhost_create(dev, iface_name, queues, dev->device.numa_node, > - flags, disable_flags); > + ret = eth_dev_vhost_create(dev, iface_name, queues, > + dev->device.numa_node, flags, disable_flags); > + if (ret == -1) > + VHOST_LOG(ERR, "Failed to create %s", name); This will set "ret" to port id on success, but we shouldn't return port id in probe. > > out_free: > rte_kvargs_free(kvlist); > -- > 1.8.3.1 > >