From patchwork Mon Nov 6 07:31:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 133885 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 067F2432B7; Mon, 6 Nov 2023 08:35:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD5094067D; Mon, 6 Nov 2023 08:34:47 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 9CCEF4027F for ; Mon, 6 Nov 2023 08:34:41 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SP30P6HtrzMmYd; Mon, 6 Nov 2023 15:30: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; Mon, 6 Nov 2023 15:34:05 +0800 From: Chengwen Feng To: , CC: , Subject: [PATCH v5 1/5] kvargs: add one new process API Date: Mon, 6 Nov 2023 07:31:20 +0000 Message-ID: <20231106073125.55280-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231106073125.55280-1-fengchengwen@huawei.com> References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231106073125.55280-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 The rte_kvargs_process() was used to handle key=value (e.g. socket_id=0), it also supports to handle only-key (e.g. socket_id). But many drivers's callback can only handle key=value, it will segment fault if handles only-key. so the patchset [1] was introduced. Because the patchset [1] modified too much drivers, therefore: 1) A new API rte_kvargs_process_opt() was introduced, it inherits the function of rte_kvargs_process() which could handle both key=value and only-key cases. 2) Constraint the rte_kvargs_process() can only handle key=value cases, it will return -1 when handle only-key case (that is the matched key's value is NULL). This patch also make sure the rte_kvargs_process_opt() and rte_kvargs_process() API both return -1 when the kvlist parameter is NULL. [1] https://patches.dpdk.org/project/dpdk/patch/20230320092110.37295-1-fengchengwen@huawei.com/ Signed-off-by: Chengwen Feng --- doc/guides/rel_notes/release_23_11.rst | 13 ++++++++ lib/kvargs/rte_kvargs.c | 43 ++++++++++++++++++++------ lib/kvargs/rte_kvargs.h | 37 ++++++++++++++++++++-- lib/kvargs/version.map | 3 ++ 4 files changed, 84 insertions(+), 12 deletions(-) diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 2213aeae7b..8db3bbbd2f 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -142,6 +142,19 @@ New Features a group's miss actions, which are the actions to be performed on packets that didn't match any of the flow rules in the group. +* **Updated kvargs process API.** + + * Introduced rte_kvargs_process_opt() API, which inherits the function + of rte_kvargs_process() and could handle both key=value and only-key + cases. + + * Constraint rte_kvargs_process() API can only handle key=value cases, + it will return -1 when handle only-key case (that is the matched key's + value is NULL). + + * Make sure rte_kvargs_process_opt() and rte_kvargs_process() API both + return -1 when the kvlist parameter is NULL. + * **Updated Amazon ena (Elastic Network Adapter) net driver.** * Upgraded ENA HAL to latest version. diff --git a/lib/kvargs/rte_kvargs.c b/lib/kvargs/rte_kvargs.c index c77bb82feb..adc47f8898 100644 --- a/lib/kvargs/rte_kvargs.c +++ b/lib/kvargs/rte_kvargs.c @@ -167,31 +167,56 @@ rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match) return ret; } -/* - * For each matching key, call the given handler function. - */ -int -rte_kvargs_process(const struct rte_kvargs *kvlist, - const char *key_match, - arg_handler_t handler, - void *opaque_arg) +static int +kvargs_process_common(const struct rte_kvargs *kvlist, + const char *key_match, + arg_handler_t handler, + void *opaque_arg, + bool support_only_key) { const struct rte_kvargs_pair *pair; unsigned i; if (kvlist == NULL) - return 0; + return -1; for (i = 0; i < kvlist->count; i++) { pair = &kvlist->pairs[i]; if (key_match == NULL || strcmp(pair->key, key_match) == 0) { + if (!support_only_key && pair->value == NULL) + return -1; if ((*handler)(pair->key, pair->value, opaque_arg) < 0) return -1; } } + return 0; } +/* + * For each matching key in key/value, call the given handler function. + */ +int +rte_kvargs_process(const struct rte_kvargs *kvlist, + const char *key_match, + arg_handler_t handler, + void *opaque_arg) +{ + return kvargs_process_common(kvlist, key_match, handler, opaque_arg, false); +} + +/* + * For each matching key in key/value or only-key, call the given handler function. + */ +int +rte_kvargs_process_opt(const struct rte_kvargs *kvlist, + const char *key_match, + arg_handler_t handler, + void *opaque_arg) +{ + return kvargs_process_common(kvlist, key_match, handler, opaque_arg, true); +} + /* free the rte_kvargs structure */ void rte_kvargs_free(struct rte_kvargs *kvlist) diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h index 4900b750bc..ad0b609ad7 100644 --- a/lib/kvargs/rte_kvargs.h +++ b/lib/kvargs/rte_kvargs.h @@ -172,14 +172,17 @@ const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist, const char *key, const char *value); /** - * Call a handler function for each key/value matching the key + * Call a handler function for each key=value matching the key * - * For each key/value association that matches the given key, calls the + * For each key=value association that matches the given key, calls the * handler function with the for a given arg_name passing the value on the * dictionary for that key and a given extra argument. * + * @note Compared to @see rte_kvargs_process_opt, this API will return -1 + * when handle only-key case (that is the matched key's value is NULL). + * * @param kvlist - * The rte_kvargs structure. No error if NULL. + * The rte_kvargs structure. * @param key_match * The key on which the handler should be called, or NULL to process handler * on all associations @@ -195,6 +198,34 @@ const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist, int rte_kvargs_process(const struct rte_kvargs *kvlist, const char *key_match, arg_handler_t handler, void *opaque_arg); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Call a handler function for each key=value or only-key matching the key + * + * For each key=value or only-key association that matches the given key, calls + * the handler function with the for a given arg_name passing the value on the + * dictionary for that key and a given extra argument. + * + * @param kvlist + * The rte_kvargs structure. + * @param key_match + * The key on which the handler should be called, or NULL to process handler + * on all associations + * @param handler + * The function to call for each matching key + * @param opaque_arg + * A pointer passed unchanged to the handler + * + * @return + * - 0 on success + * - Negative on error + */ +__rte_experimental +int rte_kvargs_process_opt(const struct rte_kvargs *kvlist, + const char *key_match, arg_handler_t handler, void *opaque_arg); + /** * Count the number of associations matching the given key * diff --git a/lib/kvargs/version.map b/lib/kvargs/version.map index 387a94e725..15d482e9b3 100644 --- a/lib/kvargs/version.map +++ b/lib/kvargs/version.map @@ -16,4 +16,7 @@ EXPERIMENTAL { # added in 21.11 rte_kvargs_get_with_value; + + # added in 23.11 + rte_kvargs_process_opt; }; From patchwork Mon Nov 6 07:31:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 133882 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 B3A1D432B7; Mon, 6 Nov 2023 08:34:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 705BC402B6; Mon, 6 Nov 2023 08:34:43 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id A355C402BA for ; Mon, 6 Nov 2023 08:34:41 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SP30P6Ym8zMmb3; Mon, 6 Nov 2023 15:30: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; Mon, 6 Nov 2023 15:34:06 +0800 From: Chengwen Feng To: , , Andrew Rybchenko CC: , Subject: [PATCH v5 2/5] net/sfc: use new API to parse kvargs Date: Mon, 6 Nov 2023 07:31:21 +0000 Message-ID: <20231106073125.55280-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231106073125.55280-1-fengchengwen@huawei.com> References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231106073125.55280-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 The sfc_kvargs_process() and sfc_efx_dev_class_get() function could handle both key=value and only-key, so they should use rte_kvargs_process_opt() instead of rte_kvargs_process() to parse. Signed-off-by: Chengwen Feng --- drivers/common/sfc_efx/sfc_efx.c | 4 ++-- drivers/net/sfc/sfc_kvargs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/common/sfc_efx/sfc_efx.c b/drivers/common/sfc_efx/sfc_efx.c index 2dc5545760..3ebac909f1 100644 --- a/drivers/common/sfc_efx/sfc_efx.c +++ b/drivers/common/sfc_efx/sfc_efx.c @@ -52,8 +52,8 @@ sfc_efx_dev_class_get(struct rte_devargs *devargs) return dev_class; if (rte_kvargs_count(kvargs, RTE_DEVARGS_KEY_CLASS) != 0) { - rte_kvargs_process(kvargs, RTE_DEVARGS_KEY_CLASS, - sfc_efx_kvarg_dev_class_handler, &dev_class); + rte_kvargs_process_opt(kvargs, RTE_DEVARGS_KEY_CLASS, + sfc_efx_kvarg_dev_class_handler, &dev_class); } rte_kvargs_free(kvargs); diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c index 783cb43ae6..24bb896179 100644 --- a/drivers/net/sfc/sfc_kvargs.c +++ b/drivers/net/sfc/sfc_kvargs.c @@ -70,7 +70,7 @@ sfc_kvargs_process(struct sfc_adapter *sa, const char *key_match, if (sa->kvargs == NULL) return 0; - return -rte_kvargs_process(sa->kvargs, key_match, handler, opaque_arg); + return -rte_kvargs_process_opt(sa->kvargs, key_match, handler, opaque_arg); } int From patchwork Mon Nov 6 07:31:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 133884 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 3FFF7432B7; Mon, 6 Nov 2023 08:34:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C1D8402EC; Mon, 6 Nov 2023 08:34:45 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id A9204402BD for ; Mon, 6 Nov 2023 08:34:41 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SP30P6p1JzMmb7; Mon, 6 Nov 2023 15:30: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; Mon, 6 Nov 2023 15:34:06 +0800 From: Chengwen Feng To: , CC: , Subject: [PATCH v5 3/5] net/tap: use new API to parse kvargs Date: Mon, 6 Nov 2023 07:31:22 +0000 Message-ID: <20231106073125.55280-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231106073125.55280-1-fengchengwen@huawei.com> References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231106073125.55280-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 Some kvargs could be key=value or only-key, it should use rte_kvargs_process_opt() instead of rte_kvargs_process() to handle these kvargs. Signed-off-by: Chengwen Feng --- drivers/net/tap/rte_eth_tap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b41fa971cb..cdb52cf408 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2292,7 +2292,7 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) kvlist = rte_kvargs_parse(params, valid_arguments); if (kvlist) { if (rte_kvargs_count(kvlist, ETH_TAP_IFACE_ARG) == 1) { - ret = rte_kvargs_process(kvlist, + ret = rte_kvargs_process_opt(kvlist, ETH_TAP_IFACE_ARG, &set_interface_name, tun_name); @@ -2496,10 +2496,10 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) kvlist = rte_kvargs_parse(params, valid_arguments); if (kvlist) { if (rte_kvargs_count(kvlist, ETH_TAP_IFACE_ARG) == 1) { - ret = rte_kvargs_process(kvlist, - ETH_TAP_IFACE_ARG, - &set_interface_name, - tap_name); + ret = rte_kvargs_process_opt(kvlist, + ETH_TAP_IFACE_ARG, + &set_interface_name, + tap_name); if (ret == -1) goto leave; } From patchwork Mon Nov 6 07:31:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 133883 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 5120F432B7; Mon, 6 Nov 2023 08:34:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8398C402D5; Mon, 6 Nov 2023 08:34:44 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 9D9BF402B6 for ; Mon, 6 Nov 2023 08:34:41 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SP30P72KjzMmbD; Mon, 6 Nov 2023 15:30: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; Mon, 6 Nov 2023 15:34:06 +0800 From: Chengwen Feng To: , , Chaoyong He CC: , Subject: [PATCH v5 4/5] common/nfp: use new API to parse kvargs Date: Mon, 6 Nov 2023 07:31:23 +0000 Message-ID: <20231106073125.55280-5-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231106073125.55280-1-fengchengwen@huawei.com> References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231106073125.55280-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 The nfp_parse_class_options() function could handle both key=value and only-key, so it should use rte_kvargs_process_opt() instead of rte_kvargs_process() to parse. Signed-off-by: Chengwen Feng --- drivers/common/nfp/nfp_common_pci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/common/nfp/nfp_common_pci.c b/drivers/common/nfp/nfp_common_pci.c index 723035d0f7..5c36052f9d 100644 --- a/drivers/common/nfp/nfp_common_pci.c +++ b/drivers/common/nfp/nfp_common_pci.c @@ -170,10 +170,8 @@ nfp_parse_class_options(const struct rte_devargs *devargs) if (kvargs == NULL) return dev_class; - if (rte_kvargs_count(kvargs, RTE_DEVARGS_KEY_CLASS) != 0) { - rte_kvargs_process(kvargs, RTE_DEVARGS_KEY_CLASS, - nfp_kvarg_dev_class_handler, &dev_class); - } + rte_kvargs_process_opt(kvargs, RTE_DEVARGS_KEY_CLASS, + nfp_kvarg_dev_class_handler, &dev_class); rte_kvargs_free(kvargs); From patchwork Mon Nov 6 07:31:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 133886 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 5D5DF432B7; Mon, 6 Nov 2023 08:35:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C903140691; Mon, 6 Nov 2023 08:34:48 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 1EA344027F for ; Mon, 6 Nov 2023 08:34:43 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SP30Q0QRqzMmZm; Mon, 6 Nov 2023 15:30: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; Mon, 6 Nov 2023 15:34:06 +0800 From: Chengwen Feng To: , , Zyta Szpak , Liron Himi , Ferruh Yigit , Yelena Krivosheev , Dmitri Epshtein , Andrzej Ostruszka CC: , Subject: [PATCH v5 5/5] net/mvneta: fix possible out-of-bounds write Date: Mon, 6 Nov 2023 07:31:24 +0000 Message-ID: <20231106073125.55280-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231106073125.55280-1-fengchengwen@huawei.com> References: <20230314124813.39521-1-fengchengwen@huawei.com> <20231106073125.55280-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 The mvneta_ifnames_get() function will save 'iface' value to ifnames, it will out-of-bounds write if passed many iface pairs (e.g. 'iface=xxx,iface=xxx,...'). Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Acked-by: Ferruh Yigit Acked-by: Huisong Li --- drivers/net/mvneta/mvneta_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index daa69e533a..8032a712f4 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -91,6 +91,9 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value, { struct mvneta_ifnames *ifnames = extra_args; + if (ifnames->idx >= NETA_NUM_ETH_PPIO) + return -EINVAL; + ifnames->names[ifnames->idx++] = value; return 0;