patch 'net/mlx5: fix build with GCC 12 and ASan' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:25:18 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/11/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/644bcdb856d6f2cc6e82ffb5d7e7bf852852b6a1

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 644bcdb856d6f2cc6e82ffb5d7e7bf852852b6a1 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Wed, 22 Mar 2023 18:06:27 +0100
Subject: [PATCH] net/mlx5: fix build with GCC 12 and ASan
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit e17840756179410283ef03660578310874432f40 ]

Building with gcc 12 and ASan raises this warning:

../drivers/net/mlx5/mlx5_txpp.c: In function ‘mlx5_txpp_xstats_get_names’:
../drivers/net/mlx5/mlx5_txpp.c:1066:25: error: ‘strncpy’ specified bound
	64 equals destination size [-Werror=stringop-truncation]
 1066 |                         strncpy(xstats_names[i + n_used].name,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1067 |                                 mlx5_txpp_stat_names[i],
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~
 1068 |                                 RTE_ETH_XSTATS_NAME_SIZE);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Prefer strlcpy for xstats.

Fixes: 3b025c0ca425 ("net/mlx5: provide send scheduling error statistics")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Raslan Darawsheh <rasland at nvidia.com>
---
 drivers/net/mlx5/mlx5_stats.c | 3 +--
 drivers/net/mlx5/mlx5_txpp.c  | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index f64fa3587b..615e1d073d 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -288,10 +288,9 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev,
 
 	if (n >= mlx5_xstats_n && xstats_names) {
 		for (i = 0; i != mlx5_xstats_n; ++i) {
-			strncpy(xstats_names[i].name,
+			strlcpy(xstats_names[i].name,
 				xstats_ctrl->info[i].dpdk_name,
 				RTE_ETH_XSTATS_NAME_SIZE);
-			xstats_names[i].name[RTE_ETH_XSTATS_NAME_SIZE - 1] = 0;
 		}
 	}
 	mlx5_xstats_n = mlx5_txpp_xstats_get_names(dev, xstats_names,
diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c
index 63d98dbde9..0e1da1d5f5 100644
--- a/drivers/net/mlx5/mlx5_txpp.c
+++ b/drivers/net/mlx5/mlx5_txpp.c
@@ -1063,11 +1063,9 @@ int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
 
 	if (n >= n_used + n_txpp && xstats_names) {
 		for (i = 0; i < n_txpp; ++i) {
-			strncpy(xstats_names[i + n_used].name,
+			strlcpy(xstats_names[i + n_used].name,
 				mlx5_txpp_stat_names[i],
 				RTE_ETH_XSTATS_NAME_SIZE);
-			xstats_names[i + n_used].name
-					[RTE_ETH_XSTATS_NAME_SIZE - 1] = 0;
 		}
 	}
 	return n_used + n_txpp;
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:42.091907500 +0800
+++ 0130-net-mlx5-fix-build-with-GCC-12-and-ASan.patch	2023-04-09 21:45:38.799042200 +0800
@@ -1 +1 @@
-From e17840756179410283ef03660578310874432f40 Mon Sep 17 00:00:00 2001
+From 644bcdb856d6f2cc6e82ffb5d7e7bf852852b6a1 Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit e17840756179410283ef03660578310874432f40 ]
@@ -25 +27,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list