* [PATCH v2 16/17] net/vhost: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Maxime Coquelin, Chenbo Xia
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 2e16597c4bda ("net/vhost: move to vhost library statistics API")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/vhost/rte_eth_vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 05940f2461..82e9fc929a 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -209,7 +209,7 @@ vhost_dev_xstats_get_names(struct rte_eth_dev *dev,
}
for (i = 0; i < count; i++)
- strncpy(xstats_names[i].name, name[i].name, RTE_ETH_XSTATS_NAME_SIZE);
+ strlcpy(xstats_names[i].name, name[i].name, RTE_ETH_XSTATS_NAME_SIZE);
free(name);
--
2.53.0
^ permalink raw reply related
* [PATCH v2 15/17] net/softnic: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Cristian Dumitrescu, Jasvinder Singh
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 7709a63bf178 ("net/softnic: add connection agent")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/softnic/conn.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/softnic/conn.c b/drivers/net/softnic/conn.c
index 5b031358d5..398f864d16 100644
--- a/drivers/net/softnic/conn.c
+++ b/drivers/net/softnic/conn.c
@@ -15,6 +15,8 @@
#include <arpa/inet.h>
#include <errno.h>
+#include <rte_string_fns.h>
+
#include "conn.h"
#define MSG_CMD_TOO_LONG "Command too long."
@@ -116,8 +118,8 @@ softnic_conn_init(struct softnic_conn_params *p)
}
/* Fill in */
- strncpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX);
- strncpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX);
+ strlcpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX + 1);
+ strlcpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX + 1);
conn->buf_size = p->buf_size;
conn->msg_in_len_max = p->msg_in_len_max;
conn->msg_out_len_max = p->msg_out_len_max;
--
2.53.0
^ permalink raw reply related
* [PATCH v2 14/17] net/qede: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Devendra Singh Rawat, Alok Prasad,
Harish Patil, Rasesh Mody, Sony Chacko
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 2ea6f76aff40 ("qede: add core driver")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/qede/qede_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 4efc2dd349..2f37f956cb 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2596,7 +2596,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
params.drv_minor = QEDE_PMD_VERSION_MINOR;
params.drv_rev = QEDE_PMD_VERSION_REVISION;
params.drv_eng = QEDE_PMD_VERSION_PATCH;
- strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
+ strlcpy((char *)params.name, QEDE_PMD_VER_PREFIX,
QEDE_PMD_DRV_VER_STR_SIZE);
qede_assign_rxtx_handlers(eth_dev, true);
--
2.53.0
^ permalink raw reply related
* [PATCH v2 13/17] net/nfp: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Chaoyong He, Alejandro Lucero
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/nfp/nfpcore/nfp_resource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c
index 6437a78852..781350c46f 100644
--- a/drivers/net/nfp/nfpcore/nfp_resource.c
+++ b/drivers/net/nfp/nfpcore/nfp_resource.c
@@ -168,7 +168,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp,
memset(res, 0, sizeof(*res));
- strncpy(res->name, name, NFP_RESOURCE_ENTRY_NAME_SZ);
+ strlcpy(res->name, name, sizeof(res->name));
dev_mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET,
NFP_RESOURCE_TBL_BASE, NFP_RESOURCE_TBL_KEY);
--
2.53.0
^ permalink raw reply related
* [PATCH v2 12/17] net/mlx5: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Michael Baum,
Gregory Etelson
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: ca1418ce3910 ("common/mlx5: share device context object")
Fixes: 9e58a50c059f ("net/mlx5: fix interface name parameter definition")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/mlx5/mlx5.c | 8 ++++----
drivers/net/mlx5/windows/mlx5_ethdev_os.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 61c26d1206..24fda18710 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1916,10 +1916,10 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
sh->txpp.skew = sh->config.tx_skew;
sh->refcnt = 1;
sh->max_port = spawn->max_port;
- strncpy(sh->ibdev_name, mlx5_os_get_ctx_device_name(sh->cdev->ctx),
- sizeof(sh->ibdev_name) - 1);
- strncpy(sh->ibdev_path, mlx5_os_get_ctx_device_path(sh->cdev->ctx),
- sizeof(sh->ibdev_path) - 1);
+ strlcpy(sh->ibdev_name, mlx5_os_get_ctx_device_name(sh->cdev->ctx),
+ sizeof(sh->ibdev_name));
+ strlcpy(sh->ibdev_path, mlx5_os_get_ctx_device_path(sh->cdev->ctx),
+ sizeof(sh->ibdev_path));
sh->phdev = mlx5_get_physical_device(sh->cdev);
if (!sh->phdev)
goto error;
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index e24ff367af..ecb8914a65 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -67,7 +67,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char ifname[MLX5_NAMESIZE])
}
priv = dev->data->dev_private;
context_obj = (mlx5_context_st *)priv->sh->cdev->ctx;
- strncpy(ifname, context_obj->mlx5_dev.name, MLX5_NAMESIZE);
+ strlcpy(ifname, context_obj->mlx5_dev.name, MLX5_NAMESIZE);
return 0;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 11/17] net/mlx4: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Matan Azrad, Viacheslav Ovsiienko,
Adrien Mazarguil
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 61cbdd419478 ("net/mlx4: separate device control functions")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/mlx4/mlx4_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index efc6ee4577..ff353af224 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -127,7 +127,7 @@ mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE])
rte_errno = ENODEV;
return -rte_errno;
}
- strncpy(*ifname, match, sizeof(*ifname));
+ strlcpy(*ifname, match, sizeof(*ifname));
return 0;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 10/17] net/ionic: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Andrew Boyer, Alfredo Cardigliano,
Shannon Nelson
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 5ef518098ec6 ("net/ionic: register and initialize adapter")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/ionic/ionic_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index 814bb3b8f4..d5545b1ecb 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -393,8 +393,8 @@ ionic_identify(struct ionic_adapter *adapter)
ident->drv.kernel_ver = 0;
snprintf(ident->drv.kernel_ver_str,
sizeof(ident->drv.kernel_ver_str), "DPDK");
- strncpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION,
- sizeof(ident->drv.driver_ver_str) - 1);
+ strlcpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION,
+ sizeof(ident->drv.driver_ver_str));
nwords = RTE_MIN(drv_size, cmd_size);
for (i = 0; i < nwords; i++)
--
2.53.0
^ permalink raw reply related
* [PATCH v2 09/17] net/dpaa: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Hemant Agrawal, Sachin Saxena,
Vanshika Shukla, Rohit Raj
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: ee0fa7552a0a ("net/dpaa: forbid MTU configuration for shared interface")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/dpaa/dpaa_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 9f976d179b..8b1072f9b9 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -247,7 +247,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
DPAA_PMD_ERR("Cannot open IF socket");
return -errno;
}
- strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ - 1);
+ strlcpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
DPAA_PMD_ERR("Cannot get interface mtu");
--
2.53.0
^ permalink raw reply related
* [PATCH v2 08/17] net/cnxk: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, Harman Kalra
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 804c585658ea ("net/cnxk: add representor control plane")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/cnxk/cnxk_eswitch.c | 4 ++--
drivers/net/cnxk/cnxk_rep_msg.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/cnxk/cnxk_eswitch.c b/drivers/net/cnxk/cnxk_eswitch.c
index e45c7dfd07..50c3e54109 100644
--- a/drivers/net/cnxk/cnxk_eswitch.c
+++ b/drivers/net/cnxk/cnxk_eswitch.c
@@ -124,8 +124,8 @@ cnxk_eswitch_dev_remove(struct rte_pci_device *pci_dev)
}
sun.sun_family = AF_UNIX;
sunlen = sizeof(struct sockaddr_un);
- strncpy(sun.sun_path, CNXK_ESWITCH_CTRL_MSG_SOCK_PATH,
- sizeof(sun.sun_path) - 1);
+ strlcpy(sun.sun_path, CNXK_ESWITCH_CTRL_MSG_SOCK_PATH,
+ sizeof(sun.sun_path));
if (connect(sock_fd, (struct sockaddr *)&sun, sunlen) < 0) {
plt_err("Failed to connect socket: %s, err %d",
diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c
index a222e2b5cd..7b92e7a5f7 100644
--- a/drivers/net/cnxk/cnxk_rep_msg.c
+++ b/drivers/net/cnxk/cnxk_rep_msg.c
@@ -138,7 +138,7 @@ open_socket_ctrl_channel(void)
memset(&un, 0, sizeof(struct sockaddr_un));
un.sun_family = AF_UNIX;
- strncpy(un.sun_path, CNXK_ESWITCH_CTRL_MSG_SOCK_PATH, sizeof(un.sun_path) - 1);
+ strlcpy(un.sun_path, CNXK_ESWITCH_CTRL_MSG_SOCK_PATH, sizeof(un.sun_path));
if (bind(sock_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
plt_err("Failed to bind %s: %s", un.sun_path, strerror(errno));
--
2.53.0
^ permalink raw reply related
* [PATCH v2 07/17] net/bnx2x: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Julien Aube, Stephen Hemminger,
Harish Patil
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/bnx2x/bnx2x.c | 2 +-
drivers/net/bnx2x/bnx2x_vfpf.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 8790c858d5..1a3956b224 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -3596,7 +3596,7 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x_softc *sc)
{
struct eth_stats_info *ether_stat = &sc->sp->drv_info_to_mcp.ether_stat;
- strncpy(ether_stat->version, BNX2X_DRIVER_VERSION,
+ strlcpy(ether_stat->version, BNX2X_DRIVER_VERSION,
ETH_STAT_INFO_VERSION_LEN);
sc->sp_objs[0].mac_obj.get_n_elements(sc, &sc->sp_objs[0].mac_obj,
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index 5411df3a38..23f576877f 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -303,7 +303,7 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_
PMD_DRV_LOG(DEBUG, sc, "status block count = %d, base status block = %x",
sc->igu_sb_cnt, sc->igu_base_sb);
- strncpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver));
+ strlcpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver));
if (rte_is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr))
rte_ether_addr_copy(&sc_resp.resc.current_mac_addr,
--
2.53.0
^ permalink raw reply related
* [PATCH v2 06/17] net/ark: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Shepard Siegel, Ed Czeck, John Miller
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 1131cbf0fb2b ("net/ark: stub PMD for Atomic Rules Arkville")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/ark/ark_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 9272e271e6..d6b1abf383 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -929,7 +929,7 @@ process_file_args(const char *key, const char *value, void *extra_args)
return -1;
}
if (first) {
- strncpy(args, line, ARK_MAX_ARG_LEN);
+ strlcpy(args, line, ARK_MAX_ARG_LEN);
first = 0;
} else {
strncat(args, line, ARK_MAX_ARG_LEN);
--
2.53.0
^ permalink raw reply related
* [PATCH v2 05/17] event/cnxk: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Pavan Nikhilesh, Shijith Thotton
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: b5a52c9d97e2 ("event/cnxk: add event port and queue xstats")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/event/cnxk/cnxk_eventdev_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
index 6dea91aedf..288d34bd7e 100644
--- a/drivers/event/cnxk/cnxk_eventdev_stats.c
+++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
@@ -283,7 +283,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
for (i = 0; i < xstats_mode_count; i++) {
xidx = i + start_offset;
- strncpy(xstats_names[i].name, xstats_names_copy[xidx].name,
+ strlcpy(xstats_names[i].name, xstats_names_copy[xidx].name,
sizeof(xstats_names[i].name));
ids[i] = xidx;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 04/17] crypto/scheduler: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Kai Ji, Fan Zhang, Pablo de Lara
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 50e14527b9d1 ("crypto/scheduler: improve parameters parsing")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/crypto/scheduler/scheduler_pmd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 95ce893f05..ceaefa329b 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -229,10 +229,10 @@ cryptodev_scheduler_create(const char *name,
return -ENOMEM;
}
- strncpy(sched_ctx->init_worker_names[
+ strlcpy(sched_ctx->init_worker_names[
sched_ctx->nb_init_workers],
init_params->worker_names[i],
- RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN - 1);
+ RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
sched_ctx->nb_init_workers++;
}
@@ -443,8 +443,8 @@ parse_worker_arg(const char *key __rte_unused,
return -ENOMEM;
}
- strncpy(param->worker_names[param->nb_workers++], value,
- RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN - 1);
+ strlcpy(param->worker_names[param->nb_workers++], value,
+ RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
return 0;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 03/17] crypto/mvsam: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Michael Shamis, Liron Himi,
Pablo de Lara, Tomasz Duszynski
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 25b05a1c806b ("crypto/mvsam: parse max number of sessions")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/crypto/mvsam/rte_mrvl_pmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index a824719fb0..65a63c9d62 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -1146,7 +1146,7 @@ parse_name_arg(const char *key __rte_unused,
return -EINVAL;
}
- strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
+ strlcpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
return 0;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 02/17] common/mlx5: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, Maxime Coquelin
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: aec086c9f1c8 ("common/mlx5: share kernel interface name getter")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/common/mlx5/linux/mlx5_common_os.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index e3db6c4124..53bcc9b844 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -231,7 +231,7 @@ mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname)
rte_errno = ENOENT;
return -rte_errno;
}
- strncpy(ifname, match, IF_NAMESIZE);
+ strlcpy(ifname, match, IF_NAMESIZE);
return 0;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 01/17] common/cnxk: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, Harman Kalra, Jerin Jacob,
Srikanth Yalavarthi, Rakesh Kudurumalla
In-Reply-To: <20260624103658.792750-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 014a9e222bac ("common/cnxk: add model init and IO handling API")
Fixes: b315581c66dc ("common/cnxk: skip probing SoC environment for CN9K")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/common/cnxk/roc_model.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index f0312a5400..ddd7ee8634 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -211,15 +211,15 @@ populate_model(struct roc_model *model, uint32_t midr)
if (model_db[i].impl == impl && model_db[i].part == part &&
model_db[i].major == major && model_db[i].minor == minor) {
model->flag = model_db[i].flag;
- strncpy(model->name, model_db[i].name,
- ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->name, model_db[i].name,
+ ROC_MODEL_STR_LEN_MAX);
found = true;
break;
}
not_found:
if (!found) {
model->flag = 0;
- strncpy(model->name, "unknown", ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->name, "unknown", ROC_MODEL_STR_LEN_MAX);
plt_err("Invalid RoC model (impl=0x%x, part=0x%x, major=0x%x, minor=0x%x)",
impl, part, major, minor);
}
@@ -297,7 +297,7 @@ of_env_get(struct roc_model *model)
FILE *fp;
if (access(path, F_OK) != 0) {
- strncpy(model->env, "HW_PLATFORM", ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->env, "HW_PLATFORM", ROC_MODEL_STR_LEN_MAX);
model->flag |= ROC_ENV_HW;
return;
}
--
2.53.0
^ permalink raw reply related
* [PATCH v2 00/17] drivers: replace strncpy with strlcpy
From: Bruce Richardson @ 2026-06-24 10:36 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson
In-Reply-To: <20260623165150.765443-1-bruce.richardson@intel.com>
Many uses of strncpy in DPDK drivers can be directly replaced by
a call to strlcpy instead, which is safer in that it always null-
terminates the string. This AI assisted patchset makes those
simple replacements, adjusting lengths as appropriate.
After this set, there are still a number of drivers with strncpy calls
in them, but those are not simple strncpy->strlcpy replacements, so
left for later rework.
v2:
* fix incorrect commit ids for fixlines.
* fix build errors due to missing rte_string_fns.h header include
Bruce Richardson (17):
common/cnxk: replace strncpy with strlcpy
common/mlx5: replace strncpy with strlcpy
crypto/mvsam: replace strncpy with strlcpy
crypto/scheduler: replace strncpy with strlcpy
event/cnxk: replace strncpy with strlcpy
net/ark: replace strncpy with strlcpy
net/bnx2x: replace strncpy with strlcpy
net/cnxk: replace strncpy with strlcpy
net/dpaa: replace strncpy with strlcpy
net/ionic: replace strncpy with strlcpy
net/mlx4: replace strncpy with strlcpy
net/mlx5: replace strncpy with strlcpy
net/nfp: replace strncpy with strlcpy
net/qede: replace strncpy with strlcpy
net/softnic: replace strncpy with strlcpy
net/vhost: replace strncpy with strlcpy
net/virtio: replace strncpy with strlcpy
drivers/common/cnxk/roc_model.c | 8 ++++----
drivers/common/mlx5/linux/mlx5_common_os.c | 2 +-
drivers/crypto/mvsam/rte_mrvl_pmd.c | 2 +-
drivers/crypto/scheduler/scheduler_pmd.c | 8 ++++----
drivers/event/cnxk/cnxk_eventdev_stats.c | 2 +-
drivers/net/ark/ark_ethdev.c | 2 +-
drivers/net/bnx2x/bnx2x.c | 2 +-
drivers/net/bnx2x/bnx2x_vfpf.c | 2 +-
drivers/net/cnxk/cnxk_eswitch.c | 4 ++--
drivers/net/cnxk/cnxk_rep_msg.c | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 2 +-
drivers/net/ionic/ionic_main.c | 4 ++--
drivers/net/mlx4/mlx4_ethdev.c | 2 +-
drivers/net/mlx5/mlx5.c | 8 ++++----
drivers/net/mlx5/windows/mlx5_ethdev_os.c | 2 +-
drivers/net/nfp/nfpcore/nfp_resource.c | 2 +-
drivers/net/qede/qede_ethdev.c | 2 +-
drivers/net/softnic/conn.c | 6 ++++--
drivers/net/vhost/rte_eth_vhost.c | 2 +-
drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 2 +-
20 files changed, 34 insertions(+), 32 deletions(-)
--
2.53.0
^ permalink raw reply
* [PATCH v2] examples: use strlcpy and strlcat
From: Bruce Richardson @ 2026-06-24 10:27 UTC (permalink / raw)
To: dev; +Cc: Bruce Richardson, stable, Radu Nicolau
In-Reply-To: <20260623154109.722441-1-bruce.richardson@intel.com>
Replace strncpy and other unbounded string functions, e.g. strcpy,
strcat, with the safer alternatives strlcpy and strlcat, so that we can
guarantee null termination of strings.
Fixes: 4bbf8e30aa5e ("examples/ip_pipeline: add CLI interface")
Fixes: 5f657a7fbe86 ("examples/pipeline: add message passing mechanism")
Fixes: 83f58a7b7b0a ("examples/pipeline: add commands for direct registers")
Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file")
Fixes: 63e8c07c7245 ("examples/ipsec-secgw: fix configuration parsing")
Fixes: 41e97c2ea9e6 ("examples/l2fwd-crypto: extend crypto information")
Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
V2: add string_fns.h header to two pipeline and ip_pipeline examples, to
fix builds on older distros without a built-in strlcpy fn.
---
examples/ip_pipeline/conn.c | 6 ++++--
examples/ipsec-secgw/sa.c | 4 ++--
examples/l2fwd-crypto/main.c | 12 ++++++------
examples/pipeline/cli.c | 4 ++--
examples/pipeline/conn.c | 6 ++++--
examples/vm_power_manager/channel_manager.c | 3 +--
6 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/examples/ip_pipeline/conn.c b/examples/ip_pipeline/conn.c
index 30fca80c14..b2406b7af1 100644
--- a/examples/ip_pipeline/conn.c
+++ b/examples/ip_pipeline/conn.c
@@ -15,6 +15,8 @@
#include <arpa/inet.h>
#include <errno.h>
+#include <rte_string_fns.h>
+
#include "conn.h"
#define MSG_CMD_TOO_LONG "Command too long."
@@ -115,8 +117,8 @@ conn_init(struct conn_params *p)
}
/* Fill in */
- strncpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX);
- strncpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX);
+ strlcpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX + 1);
+ strlcpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX + 1);
conn->buf_size = p->buf_size;
conn->msg_in_len_max = p->msg_in_len_max;
conn->msg_out_len_max = p->msg_out_len_max;
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 866ba04b86..b5068765b6 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -338,12 +338,12 @@ parse_key_string(const char *key_str, uint8_t *key)
if (pt_end == NULL) {
if (strlen(pt_start) > 2)
return 0;
- strncpy(sub_str, pt_start, 2);
+ memcpy(sub_str, pt_start, 2);
} else {
if (pt_end - pt_start > 2)
return 0;
- strncpy(sub_str, pt_start, pt_end - pt_start);
+ memcpy(sub_str, pt_start, pt_end - pt_start);
pt_start = pt_end + 1;
}
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index ff189b5fab..22ad825c91 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1576,19 +1576,19 @@ l2fwd_crypto_options_print(struct l2fwd_crypto_options *options)
char string_aead_op[MAX_STR_LEN];
if (options->cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)
- strcpy(string_cipher_op, "Encrypt");
+ strlcpy(string_cipher_op, "Encrypt", sizeof(string_cipher_op));
else
- strcpy(string_cipher_op, "Decrypt");
+ strlcpy(string_cipher_op, "Decrypt", sizeof(string_cipher_op));
if (options->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_GENERATE)
- strcpy(string_auth_op, "Auth generate");
+ strlcpy(string_auth_op, "Auth generate", sizeof(string_auth_op));
else
- strcpy(string_auth_op, "Auth verify");
+ strlcpy(string_auth_op, "Auth verify", sizeof(string_auth_op));
if (options->aead_xform.aead.op == RTE_CRYPTO_AEAD_OP_ENCRYPT)
- strcpy(string_aead_op, "Authenticated encryption");
+ strlcpy(string_aead_op, "Authenticated encryption", sizeof(string_aead_op));
else
- strcpy(string_aead_op, "Authenticated decryption");
+ strlcpy(string_aead_op, "Authenticated decryption", sizeof(string_aead_op));
printf("Options:-\nn");
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 215b4061d5..901706fab9 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -172,9 +172,9 @@ parse_table_entry(struct rte_swx_ctl_pipeline *p,
line[0] = 0;
for (i = 0; i < n_tokens; i++) {
if (i)
- strcat(line, " ");
+ strlcat(line, " ", MAX_LINE_SIZE);
- strcat(line, tokens[i]);
+ strlcat(line, tokens[i], MAX_LINE_SIZE);
}
/* Read the table entry from the input buffer. */
diff --git a/examples/pipeline/conn.c b/examples/pipeline/conn.c
index e168c4ddaa..5fb033904f 100644
--- a/examples/pipeline/conn.c
+++ b/examples/pipeline/conn.c
@@ -15,6 +15,8 @@
#include <arpa/inet.h>
#include <errno.h>
+#include <rte_string_fns.h>
+
#include "conn.h"
#define MSG_CMD_TOO_LONG "Command too long."
@@ -116,8 +118,8 @@ conn_init(struct conn_params *p)
}
/* Fill in */
- strncpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX);
- strncpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX);
+ strlcpy(conn->welcome, p->welcome, CONN_WELCOME_LEN_MAX + 1);
+ strlcpy(conn->prompt, p->prompt, CONN_PROMPT_LEN_MAX + 1);
conn->buf_size = p->buf_size;
conn->msg_in_len_max = p->msg_in_len_max;
conn->msg_out_len_max = p->msg_out_len_max;
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index b69449c61d..339c7fbb93 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -875,8 +875,7 @@ add_vm(const char *vm_name)
rte_free(new_domain);
return -1;
}
- strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
- new_domain->name[sizeof(new_domain->name) - 1] = '\0';
+ strlcpy(new_domain->name, vm_name, sizeof(new_domain->name));
memset(new_domain->channel_mask, 0, RTE_MAX_LCORE);
new_domain->num_channels = 0;
--
2.53.0
^ permalink raw reply related
* Re: [PATCH v3 04/11] bus/pci: fix mapping leak in bus cleanup
From: David Marchand @ 2026-06-24 9:56 UTC (permalink / raw)
To: fengchengwen
Cc: dev, thomas, stephen, bruce.richardson, longli, hemant.agrawal,
stable, Chenbo Xia, Nipun Gupta, Morten Brørup, Kevin Laatz
In-Reply-To: <CAJFAV8wGuVYfe7X857EauTHfeHaFEN8AFZteracs9OYFQpVN5Q@mail.gmail.com>
On Wed, 24 Jun 2026 at 08:51, David Marchand <david.marchand@redhat.com> wrote:
> > > diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> > > index fd18b8772b..791e9a7b49 100644
> > > --- a/drivers/bus/pci/pci_common.c
> > > +++ b/drivers/bus/pci/pci_common.c
> > > @@ -344,6 +344,10 @@ pci_cleanup(void)
> > > rte_errno = errno;
> > > error = -1;
> > > }
> > > +
> > > + if (drv->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
> > > + rte_pci_unmap_device(dev);
> >
> > rte_pci_unmap_device() also invoked in some drivers remove callback, e.g.
> > eth_virtio_pci_uninit()
> > ifcvf_pci_remove()
> > ...
> >
> > In this case it may doulbe-free
>
> $ git grep -l rte_pci_unmap_device drivers :^drivers/bus/pci | cut -d
> / -f 2,3 | sort -u
> net/nbl
> net/virtio
> net/xsc
> vdpa/ifc
> vdpa/nfp
> vdpa/sfc
>
> Those drivers do not set RTE_PCI_DRV_NEED_MAPPING and have their own
> logic when it comes to mapping/unmapping resources.
>
> $ for drv in $(git grep -l rte_pci_unmap_device drivers
> :^drivers/bus/pci | cut -d / -f 2,3 | sort -u); do git grep -l
> RTE_PCI_DRV_NEED_MAPPING drivers/$drv; done
> drivers/vdpa/nfp/nfp_vdpa.c
>
> I suspect calling rte_pci_unmap_device twice will end up with some
> error before a double free.
> Worth a fix on vdpa/nfp regardless, I'll work on it quickly.
Just a note.
On the principle, the vdpa/nfp driver has a double unmap bug on device
unplug, regardless of this change of mine.
--
David Marchand
^ permalink raw reply
* RE: [PATCH] net/intel: fix use of non-recommended string functions
From: Loftus, Ciara @ 2026-06-24 9:51 UTC (permalink / raw)
To: Richardson, Bruce, dev@dpdk.org
Cc: Shetty, Praveen, Burakov, Anatoly, Medvedkin, Vladimir,
Wani, Shaiq, stable@dpdk.org
In-Reply-To: <20260623112221.677931-1-bruce.richardson@intel.com>
> Subject: [PATCH] net/intel: fix use of non-recommended string functions
>
> Replace use of the strncpy and strcpy functions with the safer strlcpy
> alternative, which both bounds-checks and guarantees null termination.
> In the process also replace instances of strcat with strlcat where
> appropriate.
>
> Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
> Fixes: c4c59ae62793 ("net/cpfl: refactor flow parser")
> Fixes: c10881d3ee74 ("net/cpfl: support flow prog action")
> Fixes: 9481b0902efe ("net/ice: send driver version to firmware")
> Fixes: 7f7cbf80bdb7 ("net/ice: factorize firmware loading")
> Fixes: 549343c25db8 ("net/idpf: support device initialization")
> Fixes: 484f8e407a94 ("net/igb: support xstats by ID")
> Fixes: fca82a8accf9 ("net/ixgbe: support xstats by ID")
> Fixes: e163c18a15b0 ("net/i40e: update ptype and pctype info")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
> drivers/net/intel/cpfl/cpfl_ethdev.c | 2 +-
> drivers/net/intel/cpfl/cpfl_flow_parser.c | 16 +++++++---------
> drivers/net/intel/e1000/igb_ethdev.c | 5 +++--
> drivers/net/intel/i40e/i40e_ethdev.c | 3 +--
> drivers/net/intel/ice/ice_ethdev.c | 16 +++++++---------
> drivers/net/intel/idpf/idpf_ethdev.c | 2 +-
> drivers/net/intel/ixgbe/ixgbe_ethdev.c | 5 +++--
> 7 files changed, 23 insertions(+), 26 deletions(-)
>
^ permalink raw reply
* Re: [PATCH] common/mlx5: add ConnectX-10 NVLink-C2C device ID
From: Raslan Darawsheh @ 2026-06-24 9:35 UTC (permalink / raw)
To: dev
Cc: Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
Suanming Mou, Matan Azrad
In-Reply-To: <20260622080149.11394-1-rasland@nvidia.com>
Hi,
On 22/06/2026 11:01 AM, Raslan Darawsheh wrote:
> This adds the ConnectX-10 NVLink-C2C device ID to the list of
> NVIDIA devices that run the mlx5 drivers.
> The device is still in development stage.
>
> Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
^ permalink raw reply
* Re: [PATCH] net/mlx5: fix double free in vectorized Rx recovery
From: Raslan Darawsheh @ 2026-06-24 9:35 UTC (permalink / raw)
To: Borys Tsyrulnikov, Thomas Monjalon, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Alexander Kozyrev
Cc: dev, stable
In-Reply-To: <20260617134301.798213-1-tsyrulnikov.borys@gmail.com>
Hi,
On 17/06/2026 4:43 PM, Borys Tsyrulnikov wrote:
> During Rx queue error recovery, the vectorized path in
> mlx5_rx_err_handle() reallocates an mbuf for every queue element. When
> rte_mbuf_raw_alloc() fails (for example, the mempool is exhausted), the
> rollback loop frees the mbufs allocated so far, but masks the element
> ring index with "& elts_n" instead of "& (elts_n - 1)".
>
> elts_n is a power-of-two element count, so "x & elts_n" isolates a
> single bit and can only evaluate to 0 or elts_n, regardless of the loop
> counter. The rollback therefore never frees the mbufs just allocated in
> this pass (they are leaked); instead it repeatedly frees elts[0], a live
> mbuf still posted to the NIC (use-after-free / double free), and
> elts[elts_n], the fake_mbuf padding entry used by the vector datapath.
>
> Mask with the existing e_mask (elts_n - 1), as already done in the
> matching forward allocation loop just above.
>
> Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")
> Cc: stable@dpdk.org
>
> Signed-off-by: Borys Tsyrulnikov <tsyrulnikov.borys@gmail.com>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
^ permalink raw reply
* Re: [PATCH] examples: use strlcpy and strlcat
From: Radu Nicolau @ 2026-06-24 9:21 UTC (permalink / raw)
To: Bruce Richardson, dev
Cc: stable, Cristian Dumitrescu, Akhil Goyal, Fan Zhang,
Anatoly Burakov, Sivaprasad Tummala, Jasvinder Singh,
Sergio Gonzalez Monroy, Ferruh Yigit, Pablo de Lara,
Declan Doherty, Alan Carew
In-Reply-To: <20260623154109.722441-1-bruce.richardson@intel.com>
On 23-Jun-26 4:41 PM, Bruce Richardson wrote:
> Replace strncpy and other unbounded string functions, e.g. strcpy,
> strcat, with the safer alternatives strlcpy and strlcat, so that we can
> guarantee null termination of strings.
>
> Fixes: 4bbf8e30aa5e ("examples/ip_pipeline: add CLI interface")
> Fixes: 5f657a7fbe86 ("examples/pipeline: add message passing mechanism")
> Fixes: 83f58a7b7b0a ("examples/pipeline: add commands for direct registers")
> Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file")
> Fixes: 63e8c07c7245 ("examples/ipsec-secgw: fix configuration parsing")
> Fixes: 41e97c2ea9e6 ("examples/l2fwd-crypto: extend crypto information")
> Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
^ permalink raw reply
* RE: [PATCH v4 4/7] bpf/arm64: fix offset type to allow a negative jump
From: Marat Khalili @ 2026-06-24 8:43 UTC (permalink / raw)
To: Stephen Hemminger, dev@dpdk.org
Cc: Christophe Fontaine, stable@dpdk.org, Wathsala Vithanage,
Konstantin Ananyev, Jerin Jacob
In-Reply-To: <20260623232522.257208-5-stephen@networkplumber.org>
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday 24 June 2026 00:23
> To: dev@dpdk.org
> Cc: Christophe Fontaine <cfontain@redhat.com>; stable@dpdk.org; Stephen Hemminger
> <stephen@networkplumber.org>; Wathsala Vithanage <wathsala.vithanage@arm.com>; Konstantin Ananyev
> <konstantin.ananyev@huawei.com>; Marat Khalili <marat.khalili@huawei.com>; Jerin Jacob
> <jerinj@marvell.com>
> Subject: [PATCH v4 4/7] bpf/arm64: fix offset type to allow a negative jump
>
> From: Christophe Fontaine <cfontain@redhat.com>
>
> The DPDK BPF JIT standalone test test_ld_mbuf1 fails on arm64.
> It does:
> r6 = r1 // mbuf
> r0 = *(u8 *)pkt[0] // BPF_ABS
> if ((r0 & 0xf0) == 0x40)
> goto parse
> r0 = 0
> exit // epilogue E0
> parse:
> r0 = *(u8 *)pkt[r0 + 3] // BPF_IND
> ...
> exit
>
> emit_return_zero_if_src_zero() returns 0 by branching to a function
> epilogue. The target maybe a previous epilogue so branch
> might be backwards; therefore the offset needs to be negative.
>
> The offset was stored in a uint16_t, so a negative value wrapped to a
> large positive number; emit_b() then branched past the end of the
> program and faulted at run time.
>
> Fixes: 111e2a747a4f ("bpf/arm: add basic arithmetic operations")
> Cc: stable@dpdk.org
>
> Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/bpf/bpf_jit_arm64.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c
> index ba7ae4d680..776d7c8e97 100644
> --- a/lib/bpf/bpf_jit_arm64.c
> +++ b/lib/bpf/bpf_jit_arm64.c
> @@ -957,10 +957,12 @@ static void
> emit_return_zero_if_src_zero(struct a64_jit_ctx *ctx, bool is64, uint8_t src)
> {
> uint8_t r0 = ebpf_to_a64_reg(ctx, EBPF_REG_0);
> - uint16_t jump_to_epilogue;
> + int32_t jump_to_epilogue;
>
> emit_cbnz(ctx, is64, src, 3);
> emit_mov_imm(ctx, is64, r0, 0);
> +
> + /* maybe backwards branch to earlier epilogue */
> jump_to_epilogue = (ctx->program_start + ctx->program_sz) - ctx->idx;
> emit_b(ctx, jump_to_epilogue);
> }
> --
> 2.53.0
Acked-by: Marat Khalili <marat.khalili@huawei.com>
^ permalink raw reply
* RE: [PATCH v4 7/7] test/bpf: check that bpf_convert can be JIT'd
From: Marat Khalili @ 2026-06-24 8:39 UTC (permalink / raw)
To: Stephen Hemminger, dev@dpdk.org; +Cc: Konstantin Ananyev
In-Reply-To: <20260623232522.257208-8-stephen@networkplumber.org>
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday 24 June 2026 00:23
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Konstantin Ananyev <konstantin.ananyev@huawei.com>;
> Marat Khalili <marat.khalili@huawei.com>
> Subject: [PATCH v4 7/7] test/bpf: check that bpf_convert can be JIT'd
>
> Run each converted filter through both the interpreter and the JIT and
> check they agree, catching JIT miscompiles.
>
> test_bpf_filter and test_bpf_match did nearly the same thing: compile,
> load and run a filter against the dummy packet. Combine them into
> test_bpf_match, which now builds the packet itself and returns whether
> the filter matched. Callers run it for both load methods.
>
> The dummy packet is a UDP packet to a fixed destination MAC, source
> and destination ports, so the filter results are deterministic. None
> of the sample filters should match it, so assert that; a convert or
> JIT bug that flips a result is then caught. The destination MAC and
> source port are chosen so the negative ethernet and port filters do
> not match, and "port not 53 and not arp" is dropped as it matches
> any non-ARP packet that lacks port 53.
>
> Reduce log output to make it easier to match which expression might be
> causing issues.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Marat Khalili <marat.khalili@huawei.com>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox