patch 'cfgfile: fix section count with no name' has been queued to stable release 22.11.11

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Oct 27 17:18:47 CET 2025


Hi,

FYI, your patch has been queued to stable release 22.11.11

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/25. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/1fe0c716154309029fa3a5d4fc550e159edaee35

Thanks.

Luca Boccassi

---
>From 1fe0c716154309029fa3a5d4fc550e159edaee35 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Mon, 3 Feb 2025 13:33:19 +0100
Subject: [PATCH] cfgfile: fix section count with no name

[ upstream commit 02bce2f1e938b409bb6f85391510a2a33ecc1443 ]

Passing a NULL to strncmp is incorrect.

 + ------------------------------------------------------- +
 + Test Suite : Test Cfgfile Unit Test Suite
 + ------------------------------------------------------- +
../lib/cfgfile/rte_cfgfile.c:475:7: runtime error: null pointer passed as
	argument 2, which is declared to never be null

On the other hand, it seems the intent was to count all sections, so
skip the whole loop and section name comparisons.

Fixes: c54e7234bc9e ("test/cfgfile: add basic unit tests")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
---
 lib/cfgfile/rte_cfgfile.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index e2f77d2b64..b3701eeeb4 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -465,10 +465,14 @@ int rte_cfgfile_close(struct rte_cfgfile *cfg)
 
 int
 rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sectionname,
-size_t length)
+	size_t length)
 {
-	int i;
 	int num_sections = 0;
+	int i;
+
+	if (sectionname == NULL)
+		return cfg->num_sections;
+
 	for (i = 0; i < cfg->num_sections; i++) {
 		if (strncmp(cfg->sections[i].name, sectionname, length) == 0)
 			num_sections++;
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-10-27 15:54:35.181996801 +0000
+++ 0009-cfgfile-fix-section-count-with-no-name.patch	2025-10-27 15:54:34.719947643 +0000
@@ -1 +1 @@
-From 02bce2f1e938b409bb6f85391510a2a33ecc1443 Mon Sep 17 00:00:00 2001
+From 1fe0c716154309029fa3a5d4fc550e159edaee35 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 02bce2f1e938b409bb6f85391510a2a33ecc1443 ]
+
@@ -28 +30 @@
-index 8bbdcf146e..9723ec756f 100644
+index e2f77d2b64..b3701eeeb4 100644
@@ -31,2 +33,2 @@
-@@ -477,10 +477,14 @@ int rte_cfgfile_close(struct rte_cfgfile *cfg)
- RTE_EXPORT_SYMBOL(rte_cfgfile_num_sections)
+@@ -465,10 +465,14 @@ int rte_cfgfile_close(struct rte_cfgfile *cfg)
+ 


More information about the stable mailing list