patch 'net/mlx5: replace strncpy with strlcpy' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Oct 27 12:49:21 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

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/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/bluca/dpdk-stable

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

Thanks.

Luca Boccassi

---
>From 2b2cb8fbbae6eaa33a9855e976fd5484aa1a369c Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Wed, 24 Jun 2026 11:36:51 +0100
Subject: [PATCH] net/mlx5: replace strncpy with strlcpy

[ upstream commit a261ce3b26b76bd27d720d455ee2d5270be9feaa ]

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")

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.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 a83ec77abe8..4ba3cde2606 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1889,10 +1889,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 e24ff367afb..ecb8914a65d 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.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-10-27 11:43:56.295055482 +0000
+++ 0067-net-mlx5-replace-strncpy-with-strlcpy.patch	2026-10-27 11:43:53.578061429 +0000
@@ -1 +1 @@
-From a261ce3b26b76bd27d720d455ee2d5270be9feaa Mon Sep 17 00:00:00 2001
+From 2b2cb8fbbae6eaa33a9855e976fd5484aa1a369c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit a261ce3b26b76bd27d720d455ee2d5270be9feaa ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index 3fa38694e5..fd01f188ff 100644
+index a83ec77abe8..4ba3cde2606 100644
@@ -23 +24 @@
-@@ -1916,10 +1916,10 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
+@@ -1889,10 +1889,10 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
@@ -39 +40 @@
-index e24ff367af..ecb8914a65 100644
+index e24ff367afb..ecb8914a65d 100644


More information about the stable mailing list