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 3BD524242A; Fri, 20 Jan 2023 05:42:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1B7C42DD7; Fri, 20 Jan 2023 05:42:02 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id D532B42DA9 for ; Fri, 20 Jan 2023 05:41:57 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2254B8200A; Fri, 20 Jan 2023 04:41:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2D60C43392; Fri, 20 Jan 2023 04:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674189716; bh=zhQlLud4UOlAbT2TTNLEE5YWdFRWN//Go5LU98Xsdek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MtA5ANmJ8XUT1+IG9VNu7XPbLsBLSzpHM08xMx1KCwRTGcwbYeeJAAxhVqWwqqqfL s58IewSdQPC40Hp7Rat8vHGMpgzyD4qzbTxekFZCXSRFXQjt99lKwkNiffXw0OQ+pt mY0J9rBtHGxSt4MZSx5Bxfhcfmd4EbovR/1hwxcgjX9Pv/6/3mcOEVB8cysvZstTbF 341jao2fnWWgGLZZrfYTFc3FQGz24dwnp7StSrso6XBG+jiTRv8IiRHOs3y5eSGfG/ N7hTcHcn/bhWwsWximK60wBwxcDmALH0+ZBWIx/Zpdd5gVlPSpm6VDzYm3doitNCnq 328uI2wIdfCjw== From: okaya@kernel.org To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v3 10/10] bus/vdev: check result of rte_vdev_device_name Date: Thu, 19 Jan 2023 23:41:40 -0500 Message-Id: <20230120044140.95975-11-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230120044140.95975-1-okaya@kernel.org> References: <20230120044140.95975-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sinan Kaya In rte_eth_vdev_allocate result of call to rte_vdev_device_name is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/ethdev/ethdev_vdev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ethdev/ethdev_vdev.h b/lib/ethdev/ethdev_vdev.h index 364f140f91..6d94a65d97 100644 --- a/lib/ethdev/ethdev_vdev.h +++ b/lib/ethdev/ethdev_vdev.h @@ -34,6 +34,8 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size) { struct rte_eth_dev *eth_dev; const char *name = rte_vdev_device_name(dev); + if (name == NULL) + return NULL; eth_dev = rte_eth_dev_allocate(name); if (!eth_dev) -- 2.25.1