From patchwork Tue Nov 22 15:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120104 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3962DA0582; Tue, 22 Nov 2022 16:32:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70FBC42DAC; Tue, 22 Nov 2022 16:31:09 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id D9ADA42D92 for ; Tue, 22 Nov 2022 16:31:03 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 5A95A6175E for ; Tue, 22 Nov 2022 15:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B22C433B5; Tue, 22 Nov 2022 15:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131062; bh=zhQlLud4UOlAbT2TTNLEE5YWdFRWN//Go5LU98Xsdek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtaCEMC56Pe6v5HCM75PUTcK3czfZa9lXYk4451SkWVwNwD+2EEqhtLE1XA/OlW51 NihbzgNPUOetAETmmd3EnJwELIjx5bepi+i086fscq1xppG7T7uY7OpTxzo7bWnlGW onQ5ISW/MBihVfAELNc7vpn7R52CiDYcIxHfnl5zJ65EnLt/3zipKXw881P4Nx4sN3 +2qNJ1qABDu+LkvQ5nY5nlLnYGcG4dDr8450cZKd9GF0RdjWfMFPI+KEj7x7eLjE3Y SWfCI0lQdCNC7a1Q/xGe6Bx9xrsCsDgVS9KXqvc73r+wxz9uHunb2FSFNFpj4jEPaI 3kZunqP5jED3w== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 11/11] bus/vdev: check result of rte_vdev_device_name Date: Tue, 22 Nov 2022 10:30:53 -0500 Message-Id: <20221122153053.1172434-12-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122153053.1172434-1-okaya@kernel.org> References: <20221122153053.1172434-1-okaya@kernel.org> MIME-Version: 1.0 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)