From patchwork Tue Nov 22 15:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120094 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 A6058A0582; Tue, 22 Nov 2022 16:31:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E040442D75; Tue, 22 Nov 2022 16:30:59 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id D0C7342D70 for ; Tue, 22 Nov 2022 16:30: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 A2202B81BE7 for ; Tue, 22 Nov 2022 15:30:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A23C433C1; Tue, 22 Nov 2022 15:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131056; bh=RgYWMx2bXw0Kf6OSgrUuQ2FaHKOsqLyY7fKYUDdVLR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E179EaF4CvEGwPfton6oczRuDns1g2YzlJ41ak7AnoretaekyNnoZNmv/K5YifFaX JlG/WvlDT19Rsd6f+XJFWNobimRZuKyZFD97kGZOsTmEQSTUVXqs9EiOeN6fK3xIeQ ZjI+0hBkUSS3JRT911ww5rCD3J9L03HWdkmnagFivkzbKRUcNnYuaflLaBXAe6hXy3 gN28ravZ/X2M2NJAvEynQi4T9V64IzdUomv2ZL53MtcdOMkvq/9U8BL0D41dl9WWWy 2m6C2XJAyKtWvo1jzHcgkB+jYvVq9+IMXhGXelnZ1JnmC4PcPxmmHYwkCDn/k68yEy AUGT+nci8qErA== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 01/11] ethdev: check return result of rte_eth_dev_info_get Date: Tue, 22 Nov 2022 10:30:43 -0500 Message-Id: <20221122153053.1172434-2-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 rte_class_eth: eth_mac_cmp: The status of this call to rte_eth_dev_info_get is not checked, potentially leaving dev_info uninitialized. Signed-off-by: Sinan Kaya Acked-by: Thomas Monjalon --- lib/ethdev/rte_class_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c index 838b3a8f9f..8165e5adc0 100644 --- a/lib/ethdev/rte_class_eth.c +++ b/lib/ethdev/rte_class_eth.c @@ -51,7 +51,9 @@ eth_mac_cmp(const char *key __rte_unused, return -1; /* invalid devargs value */ /* Return 0 if devargs MAC is matching one of the device MACs. */ - rte_eth_dev_info_get(data->port_id, &dev_info); + if (rte_eth_dev_info_get(data->port_id, &dev_info) < 0) + return -1; + for (index = 0; index < dev_info.max_mac_addrs; index++) if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; From patchwork Tue Nov 22 15:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120095 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 D4B01A0582; Tue, 22 Nov 2022 16:31:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E34042D83; Tue, 22 Nov 2022 16:31:01 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 146E4427EB for ; Tue, 22 Nov 2022 16:30:58 +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 8224461756 for ; Tue, 22 Nov 2022 15:30:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8D10C4347C; Tue, 22 Nov 2022 15:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131056; bh=nDkxEv2/TwAeupXyQuSPUNIGA1QSVTVAI7IEmhVnCt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gv+1suiw80OrByl5Wmtb9GMykeV2IVDMq8Y6bUVThGL66niU4cMURl/hw7MkXohYW sgBbhHZpbUg/cOqbHERCr56KxwdKCKP9RF7wTFCPs9kqJqhgUz486qDzF7AJudixEz FgxzOhGe5Z2M9B93RJirdslvZ8c7VJh4HY2swukOaHblwfr/Q6QQdwslpGSztaSwyy 7lATd6WajFtaUqvUF4lIEn0KtsrcDcVtp3dKuKz3thmnSy23VtL0jUVfskaCSbcVR7 i2hF5/4rTu0Kff/7TgfzrlBNEbO4wDvUltgSRZOZsdkR2riSrbea6vbhXR9XnxrnDD GQSQYSjmqkdMg== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 02/11] net/tap: check if name is null Date: Tue, 22 Nov 2022 10:30:44 -0500 Message-Id: <20221122153053.1172434-3-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_pmd_tun_probe result of call to rte_vdev_device_name is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- drivers/net/tap/rte_eth_tap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index f2a6c33a19..b99439e4f2 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2340,6 +2340,9 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) struct rte_eth_dev *eth_dev; name = rte_vdev_device_name(dev); + if (name == NULL) + return -1; + params = rte_vdev_device_args(dev); memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); From patchwork Tue Nov 22 15:30:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120096 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 CC5ECA0582; Tue, 22 Nov 2022 16:31:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A63342D8A; Tue, 22 Nov 2022 16:31: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 D3378427EB for ; Tue, 22 Nov 2022 16:30:58 +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 A44A8B81BE8 for ; Tue, 22 Nov 2022 15:30:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EB85C43141; Tue, 22 Nov 2022 15:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131057; bh=K5pugBFGoxJAPUF3ZEC7fWyznWQWud30IQqSknljZ7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBy3Ufa6+KBL1J9fWOAWqH5uqPvxRKrhdy3ZPNslAbnwmKcbI1XccwsAC82YAaiUw dTcL6mqe9JLxPktzthNcf1+I1ZQyDvn1iv2gzuVtHSOeDJmpjLtsvblSHCr3hVof8/ ygQCc4S2jUytxiKz1W5ONJnn/xpeHvrlB1R5tsdZVQwNmQpZswG2iv0hdsvh52A4OE oM1Wd4V5UhYK7bBSGRotwDslWd2KIyhchOjucViiAqG5a1kAVvk6RLhHrKroBdpCGJ Q8iRee53cC9hU4Bkc111K4jY3EpTvPQ1rf//7gMYkeKY3rtae9QVWITJOrFDCJ9KgK qPztIi907bauA== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 03/11] memzone: check result of rte_fbarray_get Date: Tue, 22 Nov 2022 10:30:45 -0500 Message-Id: <20221122153053.1172434-4-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 memzone_lookup_thread_unsafe result of call to rte_fbarray_get is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/eal_common_memzone.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 860fb5fb64..8d472505eb 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -41,7 +41,7 @@ memzone_lookup_thread_unsafe(const char *name) i = rte_fbarray_find_next_used(arr, 0); while (i >= 0) { mz = rte_fbarray_get(arr, i); - if (mz->addr != NULL && + if ((mz != NULL) && (mz->addr != NULL) && !strncmp(name, mz->name, RTE_MEMZONE_NAMESIZE)) return mz; i = rte_fbarray_find_next_used(arr, i + 1); @@ -358,6 +358,10 @@ dump_memzone(const struct rte_memzone *mz, void *arg) fprintf(f, "physical segments used:\n"); ms_idx = RTE_PTR_DIFF(mz->addr, msl->base_va) / page_sz; ms = rte_fbarray_get(&msl->memseg_arr, ms_idx); + if (ms == NULL) { + RTE_LOG(DEBUG, EAL, "Skipping bad memzone\n"); + return; + } do { fprintf(f, " addr: %p iova: 0x%" PRIx64 " " From patchwork Tue Nov 22 15:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120098 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 566A3A0582; Tue, 22 Nov 2022 16:31:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCEA442D90; Tue, 22 Nov 2022 16:31:03 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 49DDB42D78 for ; Tue, 22 Nov 2022 16:31:00 +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 E5AF2B81BE8 for ; Tue, 22 Nov 2022 15:30:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1F2C433D6; Tue, 22 Nov 2022 15:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131058; bh=VjI2Ec8kMto3iRfsRyn5fX9hQQiC6ztV5fVsgiMS9yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7gs4Uhdu+OZHVElJzk1E7gEU4NpYC9MCu9/nDXCD9/TtOnWPoZEHJBrIwdBAm3H7 GeQgO98VUjTAtdmwa8DvLhUrbwJKNmEGtY8PBITaNMHnWYz7anR+0iplwFOkWixweD IRJmDNoi5kQDbVTkpNASRNAVa6t6Jq/qNlnKC8WPfhaO6SRcEYaEplPPyhIJPQr7Do SlEV4t0yDBbPfbPd501zYx8mpQmWD5OXO17prB0mfKiN9/jd0xYpnBcyRZHIeUSETq B7/O6FMBNOcheNa36WL26rdFtFRX+RScoepfC4FKq9SonIl4Uvs5/QrteH5xUZ99zR U4sFbgrkdAWbw== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 04/11] memzone: check result of malloc_elem_from_data Date: Tue, 22 Nov 2022 10:30:46 -0500 Message-Id: <20221122153053.1172434-5-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 memzone_reserve_aligned_thread_unsafe result of call to malloc_elem_from_data is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/eal_common_memzone.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 8d472505eb..930fee5fdc 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -169,6 +169,10 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len, } struct malloc_elem *elem = malloc_elem_from_data(mz_addr); + if (elem == NULL) { + rte_errno = ENOSPC; + return NULL; + } /* fill the zone in config */ mz_idx = rte_fbarray_find_next_free(arr, 0); From patchwork Tue Nov 22 15:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120097 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 B0728A0582; Tue, 22 Nov 2022 16:31:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA4BB42D8B; Tue, 22 Nov 2022 16:31: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 50F1F42D7A for ; Tue, 22 Nov 2022 16:31:00 +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 1858DB81BEB for ; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B2DC433C1; Tue, 22 Nov 2022 15:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131059; bh=e6AgEAXqwllsqVV5gZDAaE6+cqbUME7lx6SR302L8wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htLm0olrL9sRLeJdBk0fFsvN29L0tuFYHG/Rthm/m7ttQwy9Rw/D4qoGBekB+zvdU 8EumwIuaPYzyjZ0UGNvNYqmUJ7XqklyjS5riHu6PV+DaqaI5+fEkMi/Unpni+eXdaN g/yqFdcVeFiJnrM6UeZkYymPhBgm3lJ7wDffajlVO6bAsv6qiwwofd0x1hz+pwycY0 85iHFZ2mUaH/FQhukZhWjmH+WsAuQkXrSC1+E3+rNgLOew1wG3NKUuziZ5A/aPLSz8 wwtn8bRVq0ZSLYTlw0OygTd1QNfacabgoYl6eksnr4kg5MRFldzwis9wC0i2yp9LG1 V+TRFKt/2WsRw== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 05/11] malloc: malloc_elem_join_adjacent_free can return null Date: Tue, 22 Nov 2022 10:30:47 -0500 Message-Id: <20221122153053.1172434-6-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 malloc_heap_add_memory result of call to malloc_elem_join_adjacent_free is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index d7c410b786..503e551bf9 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -97,6 +97,8 @@ malloc_heap_add_memory(struct malloc_heap *heap, struct rte_memseg_list *msl, malloc_elem_insert(elem); elem = malloc_elem_join_adjacent_free(elem); + if (elem == NULL) + return NULL; malloc_elem_free_list_insert(elem); From patchwork Tue Nov 22 15:30:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120099 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 9CBB1A0582; Tue, 22 Nov 2022 16:31:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A857942D94; Tue, 22 Nov 2022 16:31:04 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 6944642D85 for ; Tue, 22 Nov 2022 16:31:01 +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 E5C2C61753 for ; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F775C43470; Tue, 22 Nov 2022 15:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131060; bh=OA9aKvIimBSPp+xtTJJVhYWAQ4KuSadN9gXKHvpeV1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNn/acZhi4H78XDj+H3tCqSjYSqrlbMbaDIkdlXsow4nkVcDJ6TQxAWi1Oi9YDHNx iar/l3+xUkmWJcK5ZHC0hjtj5ZhZ/a6PnxoBdrRciNmKHGzmCR4qL4bIq0kMyg6PKq 2rOTowmi0XMHjq+j7i6JgTNFBpYxTRKZzqxMX9LknjfME18QEBszUodLw9GUfjhtS9 94Yoazw32ueKo8Xm6WdQsO+oEOBZbYAou/JD1mEH90u6G2ZNX/Z2kbP5JS9F3SKo96 qNpHeAuTZT/afHUzWqlaFPZCD472LoglI1En9rPznC39L0IzSG+lmfat8Gbnn2aW2P Gpm53PIDsiU/A== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 06/11] malloc: check result of rte_mem_virt2memseg_list Date: Tue, 22 Nov 2022 10:30:48 -0500 Message-Id: <20221122153053.1172434-7-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 alloc_pages_on_heap result of call to rte_mem_virt2memseg_list is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 503e551bf9..3f41430e42 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -323,6 +323,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size, map_addr = ms[0]->addr; msl = rte_mem_virt2memseg_list(map_addr); + if (msl == NULL) + return NULL; /* check if we wanted contiguous memory but didn't get it */ if (contig && !eal_memalloc_is_contig(msl, map_addr, alloc_sz)) { From patchwork Tue Nov 22 15:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120101 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 40DD8A0582; Tue, 22 Nov 2022 16:31:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B2B542D9D; Tue, 22 Nov 2022 16:31:06 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 457AB42D8B for ; Tue, 22 Nov 2022 16:31:02 +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 13A01B81BE7 for ; Tue, 22 Nov 2022 15:31:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 905B1C433D7; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131060; bh=b9XPdlFmqr0VZaZ/G6xeC3g+pdTGxgCDoDwiCqKPQLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ivTdWX1+zD6K9wush6VtOHjXvajgClVbfY/rlrFQomDisp2GHR/gBM0V1LxYulxK+ g5Zn5tyZeBrGTb+wGTLksfo91EZypQnieyYZJEVEC3LVT/GzEnlzaBqqVD9h2X5pPg QE+UVEcNWjHeQxuQOJ85bN6BwLjWyIrFZfPOzp4OQsKGXIM9k/9tMUoYmx1rpBeJDZ MxRryPFp2W0qZ8oIe5/z7dm8T5DR/6cxrVQ7eXOYf4unAJILxv2F32T3R+k+ia5Wnz +Z6jUmsu3Rk70K/BnMMNSnTb4Ch/h+Seb9gVC73hFdUz7R6zhSyvYKca/OUvUwbzzM E3Cjr6UrDj2lg== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 07/11] malloc: check result of rte_fbarray_get Date: Tue, 22 Nov 2022 10:30:49 -0500 Message-Id: <20221122153053.1172434-8-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 eal_memalloc_is_contig result of call to rte_fbarray_get is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/eal_common_memalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_memalloc.c b/lib/eal/common/eal_common_memalloc.c index ab04479c1c..24506f8447 100644 --- a/lib/eal/common/eal_common_memalloc.c +++ b/lib/eal/common/eal_common_memalloc.c @@ -126,6 +126,9 @@ eal_memalloc_is_contig(const struct rte_memseg_list *msl, void *start, /* skip first iteration */ ms = rte_fbarray_get(&msl->memseg_arr, start_seg); + if (ms == NULL) + return false; + cur = ms->iova; expected = cur + pgsz; @@ -137,7 +140,7 @@ eal_memalloc_is_contig(const struct rte_memseg_list *msl, void *start, cur_seg++, expected += pgsz) { ms = rte_fbarray_get(&msl->memseg_arr, cur_seg); - if (ms->iova != expected) + if ((ms != NULL) && (ms->iova != expected)) return false; } } From patchwork Tue Nov 22 15:30:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120100 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 31D2AA0582; Tue, 22 Nov 2022 16:31:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E6D442D98; Tue, 22 Nov 2022 16:31:05 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id CF35742D85 for ; Tue, 22 Nov 2022 16:31:01 +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 9D2B4B81BEA for ; Tue, 22 Nov 2022 15:31:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1162CC433B5; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131061; bh=W2hMNo666ixKADSmKcIGEqrJdVzX4Yclf2h5OFo6Gqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVJVOTNHu0UsXX+XaKlBD0uoM9Z4fIszgRzD3VJNl681IhgCZzl+kMnF44eqN6xsT k5kc9KPSsYh0oc0imFirxsfta6CbX4IEGGIMJXhSj6pPjGOpLQzx9+cKyDjjtu45N6 PxF7pjj7LTyhjm8s7WjQr8VDmPNhv6xaFBmG8WgmAbSgavsdKfcgfpqjwDn4o295gO iztYLGLQyJ3bqaq+DKjnz74bJo4A8w911AG/cbViJMVr0xtiFZUPp6zW/e9TqsIBe5 FgCxezxnKIolrt2sKkmBLhhHSA2c7s/mXCVG41wrmKmVeUBnDNGAAWtZgKdtt6muSt Ph9zKys7IX7mw== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 08/11] malloc: check result of rte_mem_virt2memseg Date: Tue, 22 Nov 2022 10:30:50 -0500 Message-Id: <20221122153053.1172434-9-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 malloc_elem_find_max_iova_contig result of call to rte_mem_virt2memseg is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_elem.c | 11 ++++++++--- lib/eal/common/malloc_heap.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c index 83f05497cc..8f49812846 100644 --- a/lib/eal/common/malloc_elem.c +++ b/lib/eal/common/malloc_elem.c @@ -63,6 +63,8 @@ malloc_elem_find_max_iova_contig(struct malloc_elem *elem, size_t align) cur_page = RTE_PTR_ALIGN_FLOOR(contig_seg_start, page_sz); ms = rte_mem_virt2memseg(cur_page, elem->msl); + if (ms == NULL) + return 0; /* do first iteration outside the loop */ page_end = RTE_PTR_ADD(cur_page, page_sz); @@ -91,9 +93,12 @@ malloc_elem_find_max_iova_contig(struct malloc_elem *elem, size_t align) * we're not blowing past data end. */ ms = rte_mem_virt2memseg(contig_seg_start, elem->msl); - cur_page = ms->addr; - /* don't trigger another recalculation */ - expected_iova = ms->iova; + if (ms != NULL) { + cur_page = ms->addr; + + /* don't trigger another recalculation */ + expected_iova = ms->iova; + } continue; } /* cur_seg_end ends on a page boundary or on data end. if we're diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 3f41430e42..88270ce4d2 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -930,7 +930,7 @@ malloc_heap_free(struct malloc_elem *elem) const struct rte_memseg *tmp = rte_mem_virt2memseg(aligned_start, msl); - if (tmp->flags & RTE_MEMSEG_FLAG_DO_NOT_FREE) { + if ((tmp != NULL) && (tmp->flags & RTE_MEMSEG_FLAG_DO_NOT_FREE)) { /* this is an unfreeable segment, so move start */ aligned_start = RTE_PTR_ADD(tmp->addr, tmp->len); } From patchwork Tue Nov 22 15:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120102 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 02911A0582; Tue, 22 Nov 2022 16:31:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A2CB42DA1; Tue, 22 Nov 2022 16:31:07 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 5294A42D8C for ; Tue, 22 Nov 2022 16:31:02 +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 2092BB81BEB for ; Tue, 22 Nov 2022 15:31:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86946C433D6; Tue, 22 Nov 2022 15:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131061; bh=RigiKorR3dMZBI+SxDLNAndkSDREvu4zoNk+V8ONMkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SD9VprW/iXXaoAeOgrh83LRofFBQEIqA5wfBrF9WgtJOzQXkbyEVmD3PFX+l0r7XS 7tkrohWJW/qHLEwy6J6TlrMDKO/JdI+quVm/pcZxyRjG7eS3qZ3GobmrVATMpWGG6k BACnhUjZFJPc50JmA2IUkZLdw6P6q8VZzKT4a0MIdSuNSLiNNWzUMNhGzaMJEaU48h ycJfLcy+gmEjmsaKQgSyh/gkZSHZIF4IvW6biGRy3OgnoxnbLbuyhiJOBt0KCY/3Kb jL7FvxH2IzGGkDMqV8nXl6rQQbUD3RwMl/99oS3jiy+A36dmWKL/JJVSQV1JY1M99d Bm17dBr4gMT7A== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 09/11] malloc: check result of malloc_elem_free Date: Tue, 22 Nov 2022 10:30:51 -0500 Message-Id: <20221122153053.1172434-10-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 malloc_heap_free result of call to malloc_elem_free is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 88270ce4d2..6eb6fcda5e 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -892,6 +892,9 @@ malloc_heap_free(struct malloc_elem *elem) /* anything after this is a bonus */ ret = 0; + if (elem == NULL) + goto free_unlock; + /* ...of which we can't avail if we are in legacy mode, or if this is an * externally allocated segment. */ From patchwork Tue Nov 22 15:30:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120103 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 6809BA0582; Tue, 22 Nov 2022 16:32:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8EE0D42DA6; Tue, 22 Nov 2022 16:31:08 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id D7C7942D91 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 ams.source.kernel.org (Postfix) with ESMTPS id A0910B81BE8 for ; Tue, 22 Nov 2022 15:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A8F3C433C1; Tue, 22 Nov 2022 15:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131062; bh=Gu6++k0mjtkUURmjVcfqxEPEyPswM/yWIdKGnG3Ae4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XV5gOcqSJm+YkFbqWLk6NQfEXpXUfcUygqkPDF20bDnRmgZBJtqszIQ32PDqEJw7q QXeEOuFjAll2Wyx7fBfjIpmF3IGlnUp6+Zyi5OEXzAitO5KkhIw1Dkbd1IHy1YFr5m mXy98mo6l1INt9WOkKudgTNFvIKVE5hJ0JU4eMzNYdhEBMuq1nqWGlAbs+S+XNvr1j D7c7azkS/+yjsMbO6NAmNkUFV2Q84daveuHa0oYO8BNON6dPgaim5VxJKiGlzRYoWY VRpM4WNj/AHuLmi2QOYDuIZum2WxufdJbH2x+jUCm3u3fyqcAjlSnAVPuNWD28OkY5 VnTqag7FI7yrg== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 10/11] malloc: check result of elem_start_pt Date: Tue, 22 Nov 2022 10:30:52 -0500 Message-Id: <20221122153053.1172434-11-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 malloc_elem_alloc result of call to elem_start_pt is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_elem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c index 8f49812846..26296f2dba 100644 --- a/lib/eal/common/malloc_elem.c +++ b/lib/eal/common/malloc_elem.c @@ -435,6 +435,9 @@ malloc_elem_alloc(struct malloc_elem *elem, size_t size, unsigned align, { struct malloc_elem *new_elem = elem_start_pt(elem, size, align, bound, contig); + if (new_elem == NULL) + return NULL; + const size_t old_elem_size = (uintptr_t)new_elem - (uintptr_t)elem; const size_t trailer_size = elem->size - old_elem_size - size - MALLOC_ELEM_OVERHEAD; 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)