From patchwork Mon Jul 10 17:08:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 129426 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 DB7EA42E3C; Mon, 10 Jul 2023 19:08:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2440342D2F; Mon, 10 Jul 2023 19:08:12 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id C5445427EE for ; Mon, 10 Jul 2023 19:08:08 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-666e6ecb52dso2530625b3a.2 for ; Mon, 10 Jul 2023 10:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1689008888; x=1691600888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2GMFqc8q8sKJTab0kCmKrnRqp2uw/m53kujq9DrFXaU=; b=Ezh1r/8mdz0afcNJ06ZkwO4q6cE9iDOPKUFB2YJnNjgyHrdRV1l++gmkfqNCBTMjn+ ey7MsdJGpNGZGU1r+DBPvEnTLzLJjcFyTDq7jcUp4XyrgVLJrQ1k43ZAdt6b2WQxaFQu DjtYMOPOXqEgPSZQ/btYRRrHhnHLPCiFImTJoWd3L2dTp5H+SU1+4sBCoQCPcvlk0DEC IefYRMXNlNG8oVPGH7JlcSYeYZw4UUMU3fXlh5VdhpDZmbAyAkXExotG90VfNIj2F5pQ mjT5j7bXCDzfW8bUCoipC/5whNJQaRs7WuJoE4xzVs25ZTAAq6dxVjbTOLCcoRFAXiBV 0JcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689008888; x=1691600888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2GMFqc8q8sKJTab0kCmKrnRqp2uw/m53kujq9DrFXaU=; b=XJwy8bBdQk/AGXldqEhSvuC4q7gQemjlDZ7GVgNw4hxYxVG04QboiyQ8eQwq/cXnlm zAqq+pEwtDtFoWP/9kCcdPHeMGPZ+T5963qNzsPsz7UBlLqRlqOpsmyPXL/2e8U08Tll fuMsnT/YYpuYf9fDwhM1g7zJfALbYt5AsGBzTDBuTHEx9TJiMBq4onmZ7pOMLJmEfJ0n XY3A8LF8p8KlFzi5dVG1QvVL5S9CMyYxcMbKYxbIzg3CSlxoXOZAsuC+R/jHFPKauMSe TMJQgw1gVI3TQ6w46fDa6Ge44b/iD4HGw/y+k/zOa6kzH4LRcJikMpGIZ1E89fZs9Egz nwXg== X-Gm-Message-State: ABy/qLYa6onQiRb1sYswaad1l9INQFLB3C5peZGxxyafrHtdMo0ZqtK0 uAEMf/rFTQ3TBOk+KVIkI88zf/p718ruOpfSHV4/iQ== X-Google-Smtp-Source: APBJJlEiz0xVzRm66Z8hr2DmoA6HyGBwyoJSH09y8U9uQo2jsF3t9ZPiTovV/5d5Uvs/GbH727Qw8g== X-Received: by 2002:a05:6a20:a11f:b0:12c:dac0:a9a4 with SMTP id q31-20020a056a20a11f00b0012cdac0a9a4mr12969741pzk.5.1689008887778; Mon, 10 Jul 2023 10:08:07 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id q17-20020a62e111000000b00682ed27f99dsm51799pfh.46.2023.07.10.10.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 10:08:07 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Sinan Kaya , Stephen Hemminger , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH v4 5/5] bus/vdev: check result of rte_vdev_device_name Date: Mon, 10 Jul 2023 10:08:00 -0700 Message-Id: <20230710170800.12478-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710170800.12478-1-stephen@networkplumber.org> References: <20230120044140.95975-1-okaya@kernel.org> <20230710170800.12478-1-stephen@networkplumber.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 Signed-off-by: Stephen Hemminger Reviewed-by: Andrew Rybchenko --- 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 364f140f91b5..6d94a65d975d 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)