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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Mar 29 03:04:38 CEST 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/31/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://github.com/bluca/dpdk-stable

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

Thanks.

Luca Boccassi

---
>From 09d45f66377a4973f47af117fccd1a1c4b3f9aa7 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

[ 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 450037aea0..2d6c176029 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -285,10 +285,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 1f4c1081f5..c4217d1eff 100644
--- a/drivers/net/mlx5/mlx5_txpp.c
+++ b/drivers/net/mlx5/mlx5_txpp.c
@@ -1222,11 +1222,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.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-29 01:31:22.610247599 +0100
+++ 0002-net-mlx5-fix-build-with-GCC-12-and-ASan.patch	2023-03-29 01:31:22.466039159 +0100
@@ -1 +1 @@
-From e17840756179410283ef03660578310874432f40 Mon Sep 17 00:00:00 2001
+From 09d45f66377a4973f47af117fccd1a1c4b3f9aa7 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit e17840756179410283ef03660578310874432f40 ]
+
@@ -25 +26,0 @@
-Cc: stable at dpdk.org
@@ -35 +36 @@
-index f64fa3587b..615e1d073d 100644
+index 450037aea0..2d6c176029 100644
@@ -38 +39 @@
-@@ -288,10 +288,9 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev,
+@@ -285,10 +285,9 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev,
@@ -51 +52 @@
-index 63d98dbde9..0e1da1d5f5 100644
+index 1f4c1081f5..c4217d1eff 100644
@@ -54 +55 @@
-@@ -1063,11 +1063,9 @@ int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+@@ -1222,11 +1222,9 @@ int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev __rte_unused,


More information about the stable mailing list