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 9F7ABA04F7; Tue, 17 Dec 2019 02:36:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E5232B91; Tue, 17 Dec 2019 02:36:41 +0100 (CET) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id B41A8235; Tue, 17 Dec 2019 02:36:39 +0100 (CET) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 05A2F4870806A951AD6D; Tue, 17 Dec 2019 09:36:38 +0800 (CST) Received: from localhost (10.133.209.164) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Tue, 17 Dec 2019 09:36:27 +0800 From: Yunjian Wang To: CC: , , , , Yunjian Wang , Date: Tue, 17 Dec 2019 09:36:17 +0800 Message-ID: <1576546577-17048-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.209.164] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] 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" 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 --- v2: -change function eth_dev_vhost_create return 0 on success --- drivers/net/vhost/rte_eth_vhost.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 46f01a7..e927669 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1302,7 +1302,7 @@ struct vhost_xstats_name_off { } rte_eth_dev_probing_finish(eth_dev); - return data->port_id; + return 0; error: if (internal) { @@ -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); out_free: rte_kvargs_free(kvlist); -- 1.8.3.1