From patchwork Fri Nov 10 10:01:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134095 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 7D4FA432F3; Fri, 10 Nov 2023 11:05:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB89B42E3F; Fri, 10 Nov 2023 11:04:14 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id BAE4040268 for ; Fri, 10 Nov 2023 11:04:04 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZCj24nxzWhJR; Fri, 10 Nov 2023 18:03:45 +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 18:04:00 +0800 From: Chengwen Feng To: , , Keith Wiles , Ciara Power , Bruce Richardson , Jeff Guo , Jianfeng Tan CC: Subject: [PATCH v2 01/16] eal: verify strdup return value Date: Fri, 10 Nov 2023 10:01:02 +0000 Message-ID: <20231110100117.8350-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134087 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 91287432F3; Fri, 10 Nov 2023 11:04:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B65C42DD2; Fri, 10 Nov 2023 11:04:04 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id B445F42DDE for ; Fri, 10 Nov 2023 11:04:02 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRZ8H6Vmrz1P8FZ; Fri, 10 Nov 2023 18:00:47 +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 18:04:00 +0800 From: Chengwen Feng To: , , Hemant Agrawal , Sachin Saxena , Shreyansh Jain CC: Subject: [PATCH v2 02/16] bus/dpaa: verify strdup return value Date: Fri, 10 Nov 2023 10:01:03 +0000 Message-ID: <20231110100117.8350-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Sachin Saxena --- 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 10:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134092 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 200F1432F3; Fri, 10 Nov 2023 11:04:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23ACF42E20; Fri, 10 Nov 2023 11:04:10 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 7A49542DE2 for ; Fri, 10 Nov 2023 11:04:03 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRZCp0mn7ztRZL; Fri, 10 Nov 2023 18:03:50 +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 18:04:01 +0800 From: Chengwen Feng To: , , Hemant Agrawal , Sachin Saxena , Shreyansh Jain CC: Subject: [PATCH v2 03/16] bus/fslmc: verify strdup return value Date: Fri, 10 Nov 2023 10:01:04 +0000 Message-ID: <20231110100117.8350-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Sachin Saxena --- 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 10:01:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134088 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 66E46432F3; Fri, 10 Nov 2023 11:04:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 787DF42DEA; Fri, 10 Nov 2023 11:04:05 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id CFA3642DDF for ; Fri, 10 Nov 2023 11:04:02 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZ7C2DwZzPnZT; Fri, 10 Nov 2023 17:59:51 +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 18:04:01 +0800 From: Chengwen Feng To: , , Gaetan Rivet , Xueming Li , Ray Kinsella CC: Subject: [PATCH v2 04/16] bus/vdev: verify strdup return value Date: Fri, 10 Nov 2023 10:01:05 +0000 Message-ID: <20231110100117.8350-5-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Huisong Li --- 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 10:01:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134093 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 3B1BA432F3; Fri, 10 Nov 2023 11:04:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55F0442E23; Fri, 10 Nov 2023 11:04:11 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 9492E42DE8 for ; Fri, 10 Nov 2023 11:04:03 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZCk1bXFzWhHZ; Fri, 10 Nov 2023 18:03:46 +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 18:04:01 +0800 From: Chengwen Feng To: , , Bruce Richardson , Kevin Laatz , Conor Walsh CC: Subject: [PATCH v2 05/16] dma/idxd: verify strdup return value Date: Fri, 10 Nov 2023 10:01:06 +0000 Message-ID: <20231110100117.8350-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134090 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 E87C4432F3; Fri, 10 Nov 2023 11:04:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11E5942E0A; Fri, 10 Nov 2023 11:04:08 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 65CFD42DDE for ; Fri, 10 Nov 2023 11:04:03 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZCk3M8DzWhJW; Fri, 10 Nov 2023 18:03:46 +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 18:04:01 +0800 From: Chengwen Feng To: , , Pavan Nikhilesh , Shijith Thotton CC: Subject: [PATCH v2 06/16] event/cnxk: verify strdup return value Date: Fri, 10 Nov 2023 10:01:07 +0000 Message-ID: <20231110100117.8350-7-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134089 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 1C067432F3; Fri, 10 Nov 2023 11:04:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3BE542DFD; Fri, 10 Nov 2023 11:04:06 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 53B4F40268 for ; Fri, 10 Nov 2023 11:04:03 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZ7C72bpzPp9D; Fri, 10 Nov 2023 17:59:51 +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 18:04:02 +0800 From: Chengwen Feng To: , , Gaetan Rivet , Olga Shern CC: Subject: [PATCH v2 07/16] net/failsafe: fix memory leak when parse args Date: Fri, 10 Nov 2023 10:01:08 +0000 Message-ID: <20231110100117.8350-8-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134091 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 D1D3C432F3; Fri, 10 Nov 2023 11:04:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 140A442DF3; Fri, 10 Nov 2023 11:04:09 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 758CA42DDF for ; Fri, 10 Nov 2023 11:04:03 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZCk6nmrzWhJH; Fri, 10 Nov 2023 18:03:46 +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 18:04:02 +0800 From: Chengwen Feng To: , , Chaoyong He , Shihong Wang , Chang Miao CC: Subject: [PATCH v2 08/16] net/nfp: verify strdup return value Date: Fri, 10 Nov 2023 10:01:09 +0000 Message-ID: <20231110100117.8350-9-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134094 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 163C7432F3; Fri, 10 Nov 2023 11:04:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2D9F42E36; Fri, 10 Nov 2023 11:04:13 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 252AE40268 for ; Fri, 10 Nov 2023 11:04:04 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRZCq3lMmztRcm; Fri, 10 Nov 2023 18:03:51 +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 18:04:02 +0800 From: Chengwen Feng To: , , Reshma Pattan , Stephen Hemminger CC: Subject: [PATCH v2 09/16] app/dumpcap: verify strdup return value Date: Fri, 10 Nov 2023 10:01:10 +0000 Message-ID: <20231110100117.8350-10-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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..6f49703c50 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 < (unsigned int)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 10:01:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134096 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 491E5432F3; Fri, 10 Nov 2023 11:05:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB1D542E49; Fri, 10 Nov 2023 11:04:16 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 4FD2842E43 for ; Fri, 10 Nov 2023 11:04:15 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRZ8Y1W07z1P8FM; Fri, 10 Nov 2023 18:01:01 +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 18:04:14 +0800 From: Chengwen Feng To: , , Reshma Pattan , Stephen Hemminger , CC: Subject: [PATCH v2 10/16] app/pdump: verify strdup return value Date: Fri, 10 Nov 2023 10:01:11 +0000 Message-ID: <20231110100117.8350-11-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134097 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 7FEB7432F3; Fri, 10 Nov 2023 11:05:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 208EB42E4A; Fri, 10 Nov 2023 11:04:18 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id B3E4D42E45 for ; Fri, 10 Nov 2023 11:04:15 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRZD33ccDztRdJ; Fri, 10 Nov 2023 18:04:03 +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 18:04:14 +0800 From: Chengwen Feng To: , CC: Subject: [PATCH v2 11/16] app/test: verify strdup return value Date: Fri, 10 Nov 2023 10:01:12 +0000 Message-ID: <20231110100117.8350-12-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Huisong Li --- 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 10:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134098 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 1DD7D432F3; Fri, 10 Nov 2023 11:05:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30C7142E51; Fri, 10 Nov 2023 11:04:19 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id F0DB242E48 for ; Fri, 10 Nov 2023 11:04:15 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZCz37gpzWhJH; Fri, 10 Nov 2023 18:03:59 +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 18:04:14 +0800 From: Chengwen Feng To: , , Ciara Power , Michal Kobylinski , Declan Doherty , Slawomir Mrozowicz , Marcin Kerlin , Piotr Azarewicz CC: Subject: [PATCH v2 12/16] app/test-crypto-perf: verify strdup return value Date: Fri, 10 Nov 2023 10:01:13 +0000 Message-ID: <20231110100117.8350-13-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134100 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 97990432F3; Fri, 10 Nov 2023 11:05:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4929E42E61; Fri, 10 Nov 2023 11:04:22 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 8987A42E47 for ; Fri, 10 Nov 2023 11:04:16 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZ7S6p9CzPp6d; Fri, 10 Nov 2023 18:00:04 +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 18:04:15 +0800 From: Chengwen Feng To: , , Cheng Jiang , Yuan Wang , Chenbo Xia , Jiayu Hu CC: Subject: [PATCH v2 13/16] app/test-dma-perf: verify strdup return value Date: Fri, 10 Nov 2023 10:01:14 +0000 Message-ID: <20231110100117.8350-14-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Huisong Li --- 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 10:01:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134099 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 BF1E0432F3; Fri, 10 Nov 2023 11:05:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E6CB42E56; Fri, 10 Nov 2023 11:04:20 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 6D70042E45 for ; Fri, 10 Nov 2023 11:04:16 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRZD4212qztQSL; Fri, 10 Nov 2023 18:04:04 +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 18:04:15 +0800 From: Chengwen Feng To: , , Aman Singh , Yuying Zhang , Wenxuan Wu , Yuan Wang , Andrew Rybchenko , Xuan Ding CC: Subject: [PATCH v2 14/16] app/testpmd: verify strdup return value Date: Fri, 10 Nov 2023 10:01:15 +0000 Message-ID: <20231110100117.8350-15-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Ivan Malov Acked-by: Huisong Li --- 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 10:01:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134102 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 27406432F3; Fri, 10 Nov 2023 11:05:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7ADC842E6E; Fri, 10 Nov 2023 11:04:24 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id F0CB342E48 for ; Fri, 10 Nov 2023 11:04:16 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRZD01PqXzWhJW; Fri, 10 Nov 2023 18:04:00 +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 18:04:15 +0800 From: Chengwen Feng To: , , Cristian Dumitrescu , Slawomir Mrozowicz CC: Subject: [PATCH v2 15/16] examples/qos_sched: fix memory leak when parse args Date: Fri, 10 Nov 2023 10:01:16 +0000 Message-ID: <20231110100117.8350-16-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 10:01:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 134101 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 5B49A432F3; Fri, 10 Nov 2023 11:05:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53F9542E68; Fri, 10 Nov 2023 11:04:23 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id F307D42E4A for ; Fri, 10 Nov 2023 11:04:16 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SRZ752x0HzMmmd; Fri, 10 Nov 2023 17:59:45 +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 18:04:15 +0800 From: Chengwen Feng To: , , Maxime Coquelin , Chenbo Xia , Jiayu Hu , Sunil Pai G CC: Subject: [PATCH v2 16/16] examples/vhost: verify strdup return value Date: Fri, 10 Nov 2023 10:01:17 +0000 Message-ID: <20231110100117.8350-17-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231110100117.8350-1-fengchengwen@huawei.com> References: <20231110100117.8350-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 Acked-by: Huisong Li --- 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') {