patch 'net/intel: fix use of non-recommended string functions' has been queued to stable release 25.11.3
Kevin Traynor
ktraynor at redhat.com
Tue Jul 28 17:56:38 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/01/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/999c4f1e45762b273e4d741f46b99858d4bcea48
Thanks.
Kevin
---
>From 999c4f1e45762b273e4d741f46b99858d4bcea48 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Tue, 23 Jun 2026 12:22:21 +0100
Subject: [PATCH] net/intel: fix use of non-recommended string functions
[ upstream commit 11b3f7b6e2d6e64c54e4eaee4622ec2920071430 ]
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")
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Ciara Loftus <ciara.loftus at 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(-)
diff --git a/drivers/net/intel/cpfl/cpfl_ethdev.c b/drivers/net/intel/cpfl/cpfl_ethdev.c
index 617b823f5a..a770a35a2c 100644
--- a/drivers/net/intel/cpfl/cpfl_ethdev.c
+++ b/drivers/net/intel/cpfl/cpfl_ethdev.c
@@ -2535,5 +2535,5 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
adapter->host_id = get_running_host_id();
- strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE);
+ strlcpy(adapter->name, pci_dev->device.name, sizeof(adapter->name));
rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
diff --git a/drivers/net/intel/cpfl/cpfl_flow_parser.c b/drivers/net/intel/cpfl/cpfl_flow_parser.c
index e7deb619ee..b2cc7289ad 100644
--- a/drivers/net/intel/cpfl/cpfl_flow_parser.c
+++ b/drivers/net/intel/cpfl/cpfl_flow_parser.c
@@ -212,5 +212,5 @@ cpfl_flow_js_pattern_key_proto_field(json_t *ob_fields,
goto err;
}
- strncpy(js_field->fields[i].name, name, CPFL_JS_STR_SIZE - 1);
+ strlcpy(js_field->fields[i].name, name, CPFL_JS_STR_SIZE);
if (js_field->type == RTE_FLOW_ITEM_TYPE_ETH ||
@@ -648,6 +648,5 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
goto err;
}
- strncpy(js_mr_key->actions[i].prog.name, name,
- CPFL_JS_STR_SIZE - 1);
+ strlcpy(js_mr_key->actions[i].prog.name, name, CPFL_JS_STR_SIZE);
}
@@ -674,6 +673,6 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
goto err;
}
- strncpy(js_mr_key->actions[i].prog.params[j].name, name,
- CPFL_JS_STR_SIZE - 1);
+ strlcpy(js_mr_key->actions[i].prog.params[j].name, name,
+ CPFL_JS_STR_SIZE);
}
ret = cpfl_json_t_to_uint16(subobject, "size", &value);
@@ -742,5 +741,5 @@ cpfl_flow_js_mr_layout(json_t *ob_layouts, struct cpfl_flow_js_mr_action_mod *js
goto err;
}
- strncpy(js_mod->layout[i].hint, hint, CPFL_JS_STR_SIZE - 1);
+ strlcpy(js_mod->layout[i].hint, hint, CPFL_JS_STR_SIZE);
}
@@ -788,5 +787,5 @@ cpfl_flow_js_mr_content(json_t *ob_content, struct cpfl_flow_js_mr_action_mod *j
goto err;
}
- strncpy(js_mod->content.fields[i].type, type, CPFL_JS_STR_SIZE - 1);
+ strlcpy(js_mod->content.fields[i].type, type, CPFL_JS_STR_SIZE);
ret = cpfl_json_t_to_uint16(object, "start", &start);
if (ret < 0) {
@@ -1723,6 +1722,5 @@ cpfl_parse_check_prog_action(struct cpfl_flow_js_mr_key_action *key_act,
if (param->has_name) {
mr_key_prog->has_name = TRUE;
- strncpy(mr_key_prog->name[param->index], param->name,
- CPFL_JS_STR_SIZE - 1);
+ strlcpy(mr_key_prog->name[param->index], param->name, CPFL_JS_STR_SIZE);
}
}
diff --git a/drivers/net/intel/e1000/igb_ethdev.c b/drivers/net/intel/e1000/igb_ethdev.c
index 1f51ba6406..415084ea70 100644
--- a/drivers/net/intel/e1000/igb_ethdev.c
+++ b/drivers/net/intel/e1000/igb_ethdev.c
@@ -2048,6 +2048,7 @@ static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
return -1;
}
- strcpy(xstats_names[i].name,
- xstats_names_copy[ids[i]].name);
+ strlcpy(xstats_names[i].name,
+ xstats_names_copy[ids[i]].name,
+ sizeof(xstats_names[i].name));
}
return limit;
diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index ca6a07bf5f..5bab2fe910 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -11998,6 +11998,5 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
if (proto[n].proto_id != proto_id)
continue;
- memset(name, 0, sizeof(name));
- strcpy(name, proto[n].name);
+ strlcpy(name, proto[n].name, sizeof(name));
PMD_DRV_LOG(INFO, "name = %s", name);
if (!strncasecmp(name, "PPPOE", 5))
diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index c9d7325810..c683c6cc67 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -1921,5 +1921,5 @@ ice_send_driver_ver(struct ice_hw *hw)
dv.build_ver = 0;
dv.subbuild_ver = 0;
- strncpy((char *)dv.driver_string, "dpdk", sizeof(dv.driver_string));
+ strlcpy((char *)dv.driver_string, "dpdk", sizeof(dv.driver_string));
return ice_aq_send_driver_ver(hw, &dv, NULL);
@@ -2067,22 +2067,20 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
goto no_dsn;
- strncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES,
- ICE_MAX_PKG_FILENAME_SIZE);
- strcat(pkg_file, opt_ddp_filename);
+ strlcpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);
+ strlcat(pkg_file, opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE);
if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
goto load_fw;
- strncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_DEFAULT,
- ICE_MAX_PKG_FILENAME_SIZE);
- strcat(pkg_file, opt_ddp_filename);
+ strlcpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);
+ strlcat(pkg_file, opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE);
if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
goto load_fw;
no_dsn:
- strncpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);
+ strlcpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);
if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
goto load_fw;
- strncpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);
+ strlcpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);
if (rte_firmware_read(pkg_file, &buf, &bufsz) < 0) {
PMD_INIT_LOG(ERR, "failed to search file path");
diff --git a/drivers/net/intel/idpf/idpf_ethdev.c b/drivers/net/intel/idpf/idpf_ethdev.c
index 5d786fbba6..63ba733110 100644
--- a/drivers/net/intel/idpf/idpf_ethdev.c
+++ b/drivers/net/intel/idpf/idpf_ethdev.c
@@ -1206,5 +1206,5 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
- strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE);
+ strlcpy(adapter->name, pci_dev->device.name, sizeof(adapter->name));
rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 23cb9e6b48..792323dd95 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -3635,6 +3635,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
return -1;
}
- strcpy(xstats_names[i].name,
- xstats_names_copy[ids[i]].name);
+ strlcpy(xstats_names[i].name,
+ xstats_names_copy[ids[i]].name,
+ sizeof(xstats_names[i].name));
}
return limit;
--
2.55.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-07-28 16:54:52.786717320 +0100
+++ 0068-net-intel-fix-use-of-non-recommended-string-function.patch 2026-07-28 16:54:50.825728952 +0100
@@ -1 +1 @@
-From 11b3f7b6e2d6e64c54e4eaee4622ec2920071430 Mon Sep 17 00:00:00 2001
+From 999c4f1e45762b273e4d741f46b99858d4bcea48 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 11b3f7b6e2d6e64c54e4eaee4622ec2920071430 ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org
@@ -35 +36 @@
-index 7ac8797490..4315adb68c 100644
+index 617b823f5a..a770a35a2c 100644
@@ -44 +45 @@
- memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
+ rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
@@ -46 +47 @@
-index dfaddc9ec5..b1d06725e9 100644
+index e7deb619ee..b2cc7289ad 100644
@@ -56 +57 @@
-@@ -717,6 +717,5 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
+@@ -648,6 +648,5 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
@@ -64 +65 @@
-@@ -743,6 +742,6 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
+@@ -674,6 +673,6 @@ cpfl_flow_js_mr_key(json_t *ob_mr_keys, struct cpfl_flow_js_mr_key *js_mr_key)
@@ -73 +74 @@
-@@ -811,5 +810,5 @@ cpfl_flow_js_mr_layout(json_t *ob_layouts, struct cpfl_flow_js_mr_action_mod *js
+@@ -742,5 +741,5 @@ cpfl_flow_js_mr_layout(json_t *ob_layouts, struct cpfl_flow_js_mr_action_mod *js
@@ -80 +81 @@
-@@ -857,5 +856,5 @@ cpfl_flow_js_mr_content(json_t *ob_content, struct cpfl_flow_js_mr_action_mod *j
+@@ -788,5 +787,5 @@ cpfl_flow_js_mr_content(json_t *ob_content, struct cpfl_flow_js_mr_action_mod *j
@@ -87 +88 @@
-@@ -1807,6 +1806,5 @@ cpfl_parse_check_prog_action(struct cpfl_flow_js_mr_key_action *key_act,
+@@ -1723,6 +1722,5 @@ cpfl_parse_check_prog_action(struct cpfl_flow_js_mr_key_action *key_act,
@@ -96 +97 @@
-index a4370fe32b..524c030be6 100644
+index 1f51ba6406..415084ea70 100644
@@ -110 +111 @@
-index 1370db68f3..b2694cd33a 100644
+index ca6a07bf5f..5bab2fe910 100644
@@ -113 +114 @@
-@@ -11917,6 +11917,5 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
+@@ -11998,6 +11998,5 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
@@ -122 +123 @@
-index ad9c49b339..99305b604b 100644
+index c9d7325810..c683c6cc67 100644
@@ -125 +126 @@
-@@ -1898,5 +1898,5 @@ ice_send_driver_ver(struct ice_hw *hw)
+@@ -1921,5 +1921,5 @@ ice_send_driver_ver(struct ice_hw *hw)
@@ -132 +133 @@
-@@ -2055,22 +2055,20 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
+@@ -2067,22 +2067,20 @@ int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)
@@ -140 +141 @@
- if (ice_firmware_read(pkg_file, &buf, &bufsz) == 0)
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
@@ -148 +149 @@
- if (ice_firmware_read(pkg_file, &buf, &bufsz) == 0)
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
@@ -154 +155 @@
- if (ice_firmware_read(pkg_file, &buf, &bufsz) == 0)
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) == 0)
@@ -159,2 +160,2 @@
- if (ice_firmware_read(pkg_file, &buf, &bufsz) < 0) {
- PMD_INIT_LOG(ERR, "Failed to load default DDP package " ICE_PKG_FILE_DEFAULT);
+ if (rte_firmware_read(pkg_file, &buf, &bufsz) < 0) {
+ PMD_INIT_LOG(ERR, "failed to search file path");
@@ -162 +163 @@
-index fc761c6094..c13505416a 100644
+index 5d786fbba6..63ba733110 100644
@@ -165 +166 @@
-@@ -1498,5 +1498,5 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
+@@ -1206,5 +1206,5 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
@@ -171 +172 @@
- memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
+ rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities));
@@ -173 +174 @@
-index f9de95e4fc..b36867d18d 100644
+index 23cb9e6b48..792323dd95 100644
@@ -176 +177 @@
-@@ -3636,6 +3636,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
+@@ -3635,6 +3635,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
More information about the stable
mailing list