From patchwork Fri Nov 10 06:36:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134063 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 3833D432EF; Fri, 10 Nov 2023 07:39:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D41541141; Fri, 10 Nov 2023 07:39:42 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 583F3402EA for ; Fri, 10 Nov 2023 07:39:39 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRTcR6zs1zmXJY; Fri, 10 Nov 2023 14:36:23 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:37 +0800 From: Chengwen Feng To: , , Bruce Richardson , Ciara Power , Keith Wiles , Jianfeng Tan , Jeff Guo CC: Subject: [PATCH 01/16] eal: verify strdup return value Date: Fri, 10 Nov 2023 06:36:38 +0000 Message-ID: <20231110063653.5948-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup() return value logic. Fixes: 293c53d8b23c ("eal: add telemetry callbacks") Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- lib/eal/common/eal_common_options.c | 24 ++++++++++++++++++++++-- lib/eal/linux/eal_dev.c | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index a6d21f1cba..8b5a4632dd 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -226,6 +226,8 @@ eal_save_args(int argc, char **argv) if (strcmp(argv[i], "--") == 0) break; eal_args[i] = strdup(argv[i]); + if (eal_args[i] == NULL) + goto error; } eal_args[i++] = NULL; /* always finish with NULL */ @@ -235,13 +237,31 @@ eal_save_args(int argc, char **argv) eal_app_args = calloc(argc - i + 1, sizeof(*eal_args)); if (eal_app_args == NULL) - return -1; + goto error; - for (j = 0; i < argc; j++, i++) + for (j = 0; i < argc; j++, i++) { eal_app_args[j] = strdup(argv[i]); + if (eal_app_args[j] == NULL) + goto error; + } eal_app_args[j] = NULL; return 0; + +error: + if (eal_app_args != NULL) { + i = 0; + while (eal_app_args[i] != NULL) + free(eal_app_args[i++]); + free(eal_app_args); + eal_app_args = NULL; + } + i = 0; + while (eal_args[i] != NULL) + free(eal_args[i++]); + free(eal_args); + eal_args = NULL; + return -1; } #endif diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index ac76f6174d..df3cd6b39a 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -181,7 +181,10 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length) buf += 14; i += 14; strlcpy(pci_slot_name, buf, sizeof(subsystem)); + free(event->devname); event->devname = strdup(pci_slot_name); + if (event->devname == NULL) + return -1; } for (; i < length; i++) { if (*buf == '\0') From patchwork Fri Nov 10 06:36:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134065 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 96171432EF; Fri, 10 Nov 2023 07:40:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 779CE410FD; Fri, 10 Nov 2023 07:39:44 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id CD4C04026D for ; Fri, 10 Nov 2023 07:39:39 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTgt4F5NzWgnk; Fri, 10 Nov 2023 14:39:22 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:37 +0800 From: Chengwen Feng To: , , Hemant Agrawal , Sachin Saxena , Shreyansh Jain CC: Subject: [PATCH 02/16] bus/dpaa: verify strdup return value Date: Fri, 10 Nov 2023 06:36:39 +0000 Message-ID: <20231110063653.5948-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: e79df833d3f6 ("bus/dpaa: support hotplug ops") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/bus/dpaa/dpaa_bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index e57159f5d8..a67f5c9ab5 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -791,6 +791,10 @@ dpaa_bus_dev_iterate(const void *start, const char *str, /* Now that name=device_name format is available, split */ dup = strdup(str); + if (dup == NULL) { + DPAA_BUS_DEBUG("Dup string (%s) failed!\n", str); + return NULL; + } dev_name = dup + strlen("name="); if (start != NULL) { From patchwork Fri Nov 10 06:36:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134062 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 6C05A432EF; Fri, 10 Nov 2023 07:39:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E89A6402EA; Fri, 10 Nov 2023 07:39:39 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 52D1D402E7 for ; Fri, 10 Nov 2023 07:39:39 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTgt5v9yzWhC4; Fri, 10 Nov 2023 14:39:22 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:37 +0800 From: Chengwen Feng To: , , Hemant Agrawal , Sachin Saxena , Shreyansh Jain CC: Subject: [PATCH 03/16] bus/fslmc: verify strdup return value Date: Fri, 10 Nov 2023 06:36:40 +0000 Message-ID: <20231110063653.5948-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: e67a61614d0b ("bus/fslmc: support device iteration") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/bus/fslmc/fslmc_bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 57bfb5111a..89f0f329c0 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -634,6 +634,10 @@ fslmc_bus_dev_iterate(const void *start, const char *str, /* Now that name=device_name format is available, split */ dup = strdup(str); + if (dup == NULL) { + DPAA2_BUS_DEBUG("Dup string (%s) failed!\n", str); + return NULL; + } dev_name = dup + strlen("name="); if (start != NULL) { From patchwork Fri Nov 10 06:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134064 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 923CB432EF; Fri, 10 Nov 2023 07:39:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B98A427E8; Fri, 10 Nov 2023 07:39:43 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6379240DDB for ; Fri, 10 Nov 2023 07:39:39 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRTcS55vXzmXK0; Fri, 10 Nov 2023 14:36:24 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:38 +0800 From: Chengwen Feng To: , , Gaetan Rivet , Ray Kinsella , Xueming Li CC: Subject: [PATCH 04/16] bus/vdev: verify strdup return value Date: Fri, 10 Nov 2023 06:36:41 +0000 Message-ID: <20231110063653.5948-5-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/bus/vdev/vdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 7974b27295..05582f1727 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -247,6 +247,10 @@ alloc_devargs(const char *name, const char *args) devargs->data = strdup(args); else devargs->data = strdup(""); + if (devargs->data == NULL) { + free(devargs); + return NULL; + } devargs->args = devargs->data; ret = strlcpy(devargs->name, name, sizeof(devargs->name)); From patchwork Fri Nov 10 06:36:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134069 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 AA495432EF; Fri, 10 Nov 2023 07:40:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E935142DD6; Fri, 10 Nov 2023 07:39:48 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id E462A410D5 for ; Fri, 10 Nov 2023 07:39:40 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTbN3wTTzPp8v; Fri, 10 Nov 2023 14:35:28 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:38 +0800 From: Chengwen Feng To: , , Bruce Richardson , Kevin Laatz , Conor Walsh CC: Subject: [PATCH 05/16] dma/idxd: verify strdup return value Date: Fri, 10 Nov 2023 06:36:42 +0000 Message-ID: <20231110063653.5948-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: e888bb1278c6 ("dma/idxd: add bus device probing") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/dma/idxd/idxd_bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index 3b2d4c2b65..ba8076715d 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -261,9 +261,15 @@ static int is_for_this_process_use(struct rte_dsa_device *dev, const char *name) { char *runtime_dir = strdup(rte_eal_get_runtime_dir()); - char *prefix = basename(runtime_dir); - int prefixlen = strlen(prefix); int retval = 0; + int prefixlen; + char *prefix; + + if (runtime_dir == NULL) + return retval; + + prefix = basename(runtime_dir); + prefixlen = strlen(prefix); if (strncmp(name, "dpdk_", 5) == 0) retval = 1; From patchwork Fri Nov 10 06:36:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134070 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 5DD4C432EF; Fri, 10 Nov 2023 07:40:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 085A042DDF; Fri, 10 Nov 2023 07:39:50 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 41A4040ED2 for ; Fri, 10 Nov 2023 07:39:41 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRTcT1ZPXzmXKN; Fri, 10 Nov 2023 14:36:25 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:38 +0800 From: Chengwen Feng To: , , Pavan Nikhilesh , Shijith Thotton CC: Subject: [PATCH 06/16] event/cnxk: verify strdup return value Date: Fri, 10 Nov 2023 06:36:43 +0000 Message-ID: <20231110063653.5948-7-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 38c2e3240ba8 ("event/cnxk: add option to control SSO HWGRP QoS") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/event/cnxk/cnxk_eventdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c index 0c61f4c20e..1ec281e735 100644 --- a/drivers/event/cnxk/cnxk_eventdev.c +++ b/drivers/event/cnxk/cnxk_eventdev.c @@ -553,6 +553,9 @@ parse_list(const char *value, void *opaque, param_parse_t fn) char *end = NULL; char *f = s; + if (s == NULL) + return; + while (*s) { if (*s == '[') start = s; From patchwork Fri Nov 10 06:36:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134066 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 68DC2432EF; Fri, 10 Nov 2023 07:40:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87FBD42D97; Fri, 10 Nov 2023 07:39:45 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 4D70D4026D for ; Fri, 10 Nov 2023 07:39:40 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTbN6wl1zPp3v; Fri, 10 Nov 2023 14:35:28 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:38 +0800 From: Chengwen Feng To: , , Gaetan Rivet , Olga Shern CC: Subject: [PATCH 07/16] net/failsafe: fix memory leak when parse args Date: Fri, 10 Nov 2023 06:36:44 +0000 Message-ID: <20231110063653.5948-8-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Should free the memory which allocated by strdup(). Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/net/failsafe/failsafe_args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index b203e02d9a..3b867437d7 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -248,7 +248,7 @@ fs_parse_device_param(struct rte_eth_dev *dev, const char *param, goto free_args; } else { ERROR("Unrecognized device type: %.*s", (int)b, param); - return -EINVAL; + ret = -EINVAL; } free_args: free(args); From patchwork Fri Nov 10 06:36:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134067 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 47DC2432EF; Fri, 10 Nov 2023 07:40:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF8D942DAC; Fri, 10 Nov 2023 07:39:46 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7086740E72 for ; Fri, 10 Nov 2023 07:39:40 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTgw0dw3zWhBk; Fri, 10 Nov 2023 14:39:24 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:39 +0800 From: Chengwen Feng To: , , Chaoyong He , Chang Miao , Shihong Wang CC: Subject: [PATCH 08/16] net/nfp: verify strdup return value Date: Fri, 10 Nov 2023 06:36:45 +0000 Message-ID: <20231110063653.5948-9-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 3d21da66c06b ("net/nfp: create security session") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Acked-by: Chaoyong He --- drivers/net/nfp/nfp_ipsec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c index 452947380e..7ce9cca0b2 100644 --- a/drivers/net/nfp/nfp_ipsec.c +++ b/drivers/net/nfp/nfp_ipsec.c @@ -524,6 +524,11 @@ nfp_aesgcm_iv_update(struct ipsec_add_sa *cfg, uint8_t *cfg_iv; iv_str = strdup(iv_string); + if (iv_str == NULL) { + PMD_DRV_LOG(ERR, "Failed to strdup iv_string"); + return; + } + cfg_iv = (uint8_t *)cfg->aesgcm_fields.iv; for (i = 0; i < iv_len; i++) { From patchwork Fri Nov 10 06:36:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134068 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 5858A432EF; Fri, 10 Nov 2023 07:40:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEF7A42DCB; Fri, 10 Nov 2023 07:39:47 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 8E18840ED2 for ; Fri, 10 Nov 2023 07:39:40 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRTcT6v76zmXJB; Fri, 10 Nov 2023 14:36:25 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:39:39 +0800 From: Chengwen Feng To: , , Reshma Pattan , Stephen Hemminger CC: Subject: [PATCH 09/16] app/dumpcap: verify strdup return value Date: Fri, 10 Nov 2023 06:36:46 +0000 Message-ID: <20231110063653.5948-10-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/dumpcap/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 64294bbfb3..6ae2446dd9 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -639,6 +639,11 @@ static void dpdk_init(void) eal_argv[i++] = strdup(file_prefix); } + for (i = 0; i < eal_argc; i++) { + if (eal_argv[i] == NULL) + rte_panic("No memory\n"); + } + if (rte_eal_init(eal_argc, eal_argv) < 0) rte_exit(EXIT_FAILURE, "EAL init failed: is primary process running?\n"); } From patchwork Fri Nov 10 06:36:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134077 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 46416432EF; Fri, 10 Nov 2023 07:41:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02AB042DEF; Fri, 10 Nov 2023 07:40:38 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 17C4B42D89 for ; Fri, 10 Nov 2023 07:40:31 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SRTbx3KQjzMmfJ; Fri, 10 Nov 2023 14:35:57 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:27 +0800 From: Chengwen Feng To: , , Reshma Pattan , Stephen Hemminger , CC: Subject: [PATCH 10/16] app/pdump: verify strdup return value Date: Fri, 10 Nov 2023 06:36:47 +0000 Message-ID: <20231110063653.5948-11-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/pdump/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/pdump/main.c b/app/pdump/main.c index 7a1c7bdf60..a9205e130b 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -171,6 +171,9 @@ parse_device_id(const char *key __rte_unused, const char *value, struct pdump_tuples *pt = extra_args; pt->device_id = strdup(value); + if (pt->device_id == NULL) + return -1; + pt->dump_by_type = DEVICE_ID; return 0; From patchwork Fri Nov 10 06:36:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134071 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 CAE63432EF; Fri, 10 Nov 2023 07:40:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 559CE42DBE; Fri, 10 Nov 2023 07:40:31 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 7AB37410ED for ; Fri, 10 Nov 2023 07:40:29 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTcL0RpvzPpGq; Fri, 10 Nov 2023 14:36:18 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:28 +0800 From: Chengwen Feng To: , CC: Subject: [PATCH 11/16] app/test: verify strdup return value Date: Fri, 10 Nov 2023 06:36:48 +0000 Message-ID: <20231110063653.5948-12-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/test/process.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test/process.h b/app/test/process.h index af7bc3e0de..c576c42349 100644 --- a/app/test/process.h +++ b/app/test/process.h @@ -59,8 +59,11 @@ process_dup(const char *const argv[], int numargs, const char *env_value) return -1; else if (pid == 0) { /* make a copy of the arguments to be passed to exec */ - for (i = 0; i < numargs; i++) + for (i = 0; i < numargs; i++) { argv_cpy[i] = strdup(argv[i]); + if (argv_cpy[i] == NULL) + rte_panic("Error dup args\n"); + } argv_cpy[i] = NULL; num = numargs; From patchwork Fri Nov 10 06:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134072 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 610B5432EF; Fri, 10 Nov 2023 07:40:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D2CB42DA3; Fri, 10 Nov 2023 07:40:32 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id D5D6C42D2B for ; Fri, 10 Nov 2023 07:40:29 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SRTby0glMzMmgs; Fri, 10 Nov 2023 14:35:58 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:28 +0800 From: Chengwen Feng To: , , Ciara Power , Piotr Azarewicz , Marcin Kerlin , Michal Kobylinski , Declan Doherty , Slawomir Mrozowicz CC: Subject: [PATCH 12/16] app/test-crypto-perf: verify strdup return value Date: Fri, 10 Nov 2023 06:36:49 +0000 Message-ID: <20231110063653.5948-13-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/test-crypto-perf/cperf_options_parsing.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 75afedc7fd..8909b5690d 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -516,6 +516,10 @@ parse_test_file(struct cperf_options *opts, const char *arg) { opts->test_file = strdup(arg); + if (opts->test_file == NULL) { + RTE_LOG(ERR, USER1, "Dup vector file failed!\n"); + return -1; + } if (access(opts->test_file, F_OK) != -1) return 0; RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n"); From patchwork Fri Nov 10 06:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134076 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 B3294432EF; Fri, 10 Nov 2023 07:41:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F29C342E15; Fri, 10 Nov 2023 07:40:36 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 01E7342D2B for ; Fri, 10 Nov 2023 07:40:31 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRThx563Jzfb8R; Fri, 10 Nov 2023 14:40:17 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:28 +0800 From: Chengwen Feng To: , , Cheng Jiang , =?utf-8?q?Morten_Br=C3=B8rup?= , Anoob Joseph , Yuan Wang , Jiayu Hu CC: Subject: [PATCH 13/16] app/test-dma-perf: verify strdup return value Date: Fri, 10 Nov 2023 06:36:50 +0000 Message-ID: <20231110063653.5948-14-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/test-dma-perf/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c index e5bccc27da..339ee25eb5 100644 --- a/app/test-dma-perf/main.c +++ b/app/test-dma-perf/main.c @@ -206,6 +206,8 @@ parse_lcore_dma(struct test_configure *test_case, const char *value) return -1; input = strndup(value, strlen(value) + 1); + if (input == NULL) + return -1; addrs = input; while (*addrs == '\0') From patchwork Fri Nov 10 06:36:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134074 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 078E4432EF; Fri, 10 Nov 2023 07:41:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE1D542DFD; Fri, 10 Nov 2023 07:40:34 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 2A5DD42D89 for ; Fri, 10 Nov 2023 07:40:30 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRTdS0XLsz1P8FH; Fri, 10 Nov 2023 14:37:16 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:28 +0800 From: Chengwen Feng To: , , Aman Singh , Yuying Zhang , Xuan Ding , Andrew Rybchenko , Wenxuan Wu , Yuan Wang CC: Subject: [PATCH 14/16] app/testpmd: verify strdup return value Date: Fri, 10 Nov 2023 06:36:51 +0000 Message-ID: <20231110063653.5948-15-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- app/test-pmd/cmdline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 912bf3355c..904c04d466 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3528,6 +3528,8 @@ parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items, nb_item = 0; char *str2 = strdup(str); + if (str2 == NULL) + return nb_item; cur = strtok_r(str2, ",", &tmp); while (cur != NULL) { parsed_items[nb_item] = get_ptype(cur); From patchwork Fri Nov 10 06:36:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134073 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 E6291432EF; Fri, 10 Nov 2023 07:40:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D564410ED; Fri, 10 Nov 2023 07:40:33 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 28D2D410ED for ; Fri, 10 Nov 2023 07:40:30 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRThs6f23zWh3Y; Fri, 10 Nov 2023 14:40:13 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:29 +0800 From: Chengwen Feng To: , , Cristian Dumitrescu , Slawomir Mrozowicz CC: Subject: [PATCH 15/16] examples/qos_sched: fix memory leak when parse args Date: Fri, 10 Nov 2023 06:36:52 +0000 Message-ID: <20231110063653.5948-16-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Should free the memory which allocated by strdup(). Fixes: 035b6a4f4bba ("examples/qos_sched: fix out-of-bounds option parsing") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- examples/qos_sched/args.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index e97273152a..8d61d3e454 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -103,8 +103,10 @@ app_parse_opt_vals(const char *conf_str, char separator, uint32_t n_vals, uint32 n_tokens = rte_strsplit(string, strnlen(string, 32), tokens, n_vals, separator); - if (n_tokens > MAX_OPT_VALUES) + if (n_tokens > MAX_OPT_VALUES) { + free(string); return -1; + } for (i = 0; i < n_tokens; i++) opt_vals[i] = (uint32_t)atol(tokens[i]); From patchwork Fri Nov 10 06:36:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134075 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 0EF49432EF; Fri, 10 Nov 2023 07:41:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4D0B42E09; Fri, 10 Nov 2023 07:40:35 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 9E3CB410ED for ; Fri, 10 Nov 2023 07:40:30 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRTht1JGRzWh7j; Fri, 10 Nov 2023 14:40:14 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 14:40:29 +0800 From: Chengwen Feng To: , , Maxime Coquelin , Chenbo Xia , Sunil Pai G , Jiayu Hu CC: Subject: [PATCH 16/16] examples/vhost: verify strdup return value Date: Fri, 10 Nov 2023 06:36:53 +0000 Message-ID: <20231110063653.5948-17-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110063653.5948-1-fengchengwen@huawei.com> References: <20231110063653.5948-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Add verify strdup return value logic. Fixes: 53d3f4778c1d ("vhost: integrate dmadev in asynchronous data-path") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- examples/vhost/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ce5c1efddf..3fc1b151d1 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -260,6 +260,9 @@ open_dma(const char *value) char *dma_arg[RTE_MAX_VHOST_DEVICE]; int args_nr; + if (input == NULL) + return -1; + while (isblank(*addrs)) addrs++; if (*addrs == '\0') {