From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mohammad Abdul Awal Subject: [PATCH 2/3] net/virtio: fix null pointer checking Date: Wed, 3 Apr 2019 17:08:11 +0100 Message-ID: <20190403160811.1282-1-mohammad.abdul.awal@intel.com> Cc: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, Mohammad Abdul Awal To: dev@dpdk.org Return-path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 0E44D1B447 for ; Wed, 3 Apr 2019 18:08:37 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Null value of device name should return error without further processing. Fixes: 1c8489da56 ("net/virtio-user: fix multi-process support") Signed-off-by: Mohammad Abdul Awal --- drivers/net/virtio/virtio_user_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 129c2b9ef..cefc6da66 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -516,6 +516,10 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) if (rte_eal_process_type() == RTE_PROC_SECONDARY) { const char *name = rte_vdev_device_name(dev); + if (name == NULL) { + RTE_LOG(ERR, PMD, "Device name is NULL\n"); + return -1; + } eth_dev = rte_eth_dev_attach_secondary(name); if (!eth_dev) { RTE_LOG(ERR, PMD, "Failed to probe %s\n", name); -- 2.17.1