patch 'app: remove use of strncpy' has been queued to stable release 25.11.3
Kevin Traynor
ktraynor at redhat.com
Thu Jul 30 11:16:46 CEST 2026
Hi,
FYI, your patch has been queued to stable release 25.11.3
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/04/26. 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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/e9f7725525ef4771dd52cf8566f00f89118b97ad
Thanks.
Kevin
---
>From e9f7725525ef4771dd52cf8566f00f89118b97ad Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Tue, 23 Jun 2026 15:50:27 +0100
Subject: [PATCH] app: remove use of strncpy
[ upstream commit d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca ]
Use of strncpy is not recommended, so replace it with strlcpy or memcpy
as appropriate.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Fixes: 8ecd4048ba5d ("app/crypto-perf: fix string not null terminated")
Fixes: 0add6c27cd7c ("app/testeventdev: define the test options")
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Fixes: 1e8a4e97b057 ("app/testpmd: add flow dump command")
Fixes: de06137cb295 ("app/regex: add RegEx test application")
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
app/test-crypto-perf/cperf_options_parsing.c | 5 ++---
app/test-dma-perf/main.c | 2 +-
app/test-eventdev/evt_options.c | 2 +-
app/test-pmd/cmdline_flow.c | 2 +-
app/test-regex/main.c | 9 ++-------
5 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 14e731586b..0951293adb 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -482,6 +482,5 @@ parse_device_type(struct cperf_options *opts, const char *arg)
return -1;
- strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
- *(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
+ strlcpy(opts->device_type, arg, sizeof(opts->device_type));
return 0;
@@ -1126,5 +1125,5 @@ cperf_options_default(struct cperf_options *opts)
opts->imix_distribution_count = 0;
- strncpy(opts->device_type, "crypto_aesni_mb",
+ strlcpy(opts->device_type, "crypto_aesni_mb",
sizeof(opts->device_type));
opts->nb_qps = 1;
diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 4249dcfd3d..13bf07a764 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -221,5 +221,5 @@ parse_entry(const char *value, struct test_configure_entry *entry)
int ret;
- strncpy(input, value, 254);
+ strlcpy(input, value, sizeof(input));
if (*input == '\0')
goto out;
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 0e70c971eb..1da0aba386 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -24,5 +24,5 @@ evt_options_default(struct evt_options *opt)
opt->verbose_level = 1; /* Enable minimal prints */
opt->dev_id = 0;
- strncpy(opt->test_name, "order_queue", EVT_TEST_NAME_MAX_LEN);
+ strlcpy(opt->test_name, "order_queue", sizeof(opt->test_name));
opt->nb_flows = 1024;
opt->socket_id = SOCKET_ID_ANY;
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 2ae72a3dec..5188d3afdd 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -11880,5 +11880,5 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,
return len;
buf = (uint8_t *)ctx->object + arg_data->offset;
- strncpy(buf, str, len);
+ memcpy(buf, str, len);
if (ctx->objmask)
memset((uint8_t *)ctx->objmask + arg_data->offset, 0xff, len);
diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index acb834a8b4..81719f2e04 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -104,5 +104,4 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file,
int opt;
int opt_idx;
- size_t len;
static struct option lgopts[] = {
{ "help", 0, 0, ARG_HELP},
@@ -134,18 +133,14 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file,
switch (opt) {
case ARG_RULES_FILE_NAME:
- len = strnlen(optarg, MAX_FILE_NAME - 1);
- if (len == MAX_FILE_NAME)
+ if (strlcpy(rules_file, optarg, MAX_FILE_NAME) >= MAX_FILE_NAME)
rte_exit(EXIT_FAILURE,
"Rule file name to long max %d\n",
MAX_FILE_NAME - 1);
- strncpy(rules_file, optarg, MAX_FILE_NAME - 1);
break;
case ARG_DATA_FILE_NAME:
- len = strnlen(optarg, MAX_FILE_NAME - 1);
- if (len == MAX_FILE_NAME)
+ if (strlcpy(data_file, optarg, MAX_FILE_NAME) >= MAX_FILE_NAME)
rte_exit(EXIT_FAILURE,
"Data file name to long max %d\n",
MAX_FILE_NAME - 1);
- strncpy(data_file, optarg, MAX_FILE_NAME - 1);
break;
case ARG_NUM_OF_JOBS:
--
2.55.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-07-30 10:16:03.400027931 +0100
+++ 0067-app-remove-use-of-strncpy.patch 2026-07-30 10:16:01.497990770 +0100
@@ -1 +1 @@
-From d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca Mon Sep 17 00:00:00 2001
+From e9f7725525ef4771dd52cf8566f00f89118b97ad Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -27 +28 @@
-index 44c2a7173a..b1b0abbcbc 100644
+index 14e731586b..0951293adb 100644
@@ -30 +31 @@
-@@ -483,6 +483,5 @@ parse_device_type(struct cperf_options *opts, const char *arg)
+@@ -482,6 +482,5 @@ parse_device_type(struct cperf_options *opts, const char *arg)
@@ -38 +39 @@
-@@ -1135,5 +1134,5 @@ cperf_options_default(struct cperf_options *opts)
+@@ -1126,5 +1125,5 @@ cperf_options_default(struct cperf_options *opts)
@@ -68 +69 @@
-index e41ab0ef9b..fbbe36233b 100644
+index 2ae72a3dec..5188d3afdd 100644
@@ -71 +72 @@
-@@ -11912,5 +11912,5 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,
+@@ -11880,5 +11880,5 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,
More information about the stable
mailing list