patch 'net/mlx5: fix GCC uninitialized variable warning' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Mon Feb 21 16:33:56 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/26/22. 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/ab06c7bf9bbd6276cdeebaf9e4c810823b1839f7

Thanks.

Kevin

---
>From ab06c7bf9bbd6276cdeebaf9e4c810823b1839f7 Mon Sep 17 00:00:00 2001
From: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
Date: Tue, 28 Dec 2021 11:17:03 +0200
Subject: [PATCH] net/mlx5: fix GCC uninitialized variable warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit be8cda4932eb256caaca90090fe0c6d9c756f852 ]

When building with -Db_sanitize=thread, GCC gives a warning:

drivers/net/mlx5/mlx5_flow_meter.c: In function ‘mlx5_flow_meter_create’:
drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
    used uninitialized in this function [-Wmaybe-uninitialized]

This is a false-positive: legacy_fm is initialized and used
if and only if priv->sh->meter_aso_en is false.
Work around this by initializing legacy_fm to NULL.
Add an assertion before legacy_fm use in case the logic changes.

Fixes: 444320186393 ("net/mlx5: support meter creation with policy")

Reported-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_meter.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index 0e4e6ac3d5..0dc7fbfb32 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -1168,5 +1168,6 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
 	struct mlx5_flow_meter_profile *fmp;
 	struct mlx5_flow_meter_info *fm;
-	struct mlx5_legacy_flow_meter *legacy_fm;
+	/* GCC fails to infer legacy_fm is set when !priv->sh->meter_aso_en. */
+	struct mlx5_legacy_flow_meter *legacy_fm = NULL;
 	struct mlx5_flow_meter_policy *mtr_policy = NULL;
 	struct mlx5_indexed_pool_config flow_ipool_cfg = {
@@ -1274,6 +1275,8 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id,
 		goto error;
 	/* Add to the flow meter list. */
-	if (!priv->sh->meter_aso_en)
+	if (!priv->sh->meter_aso_en) {
+		MLX5_ASSERT(legacy_fm != NULL);
 		TAILQ_INSERT_TAIL(fms, legacy_fm, next);
+	}
 	/* Add to the flow meter list. */
 	fm->active_state = 1; /* Config meter starts as active. */
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-21 15:22:45.674203318 +0000
+++ 0047-net-mlx5-fix-GCC-uninitialized-variable-warning.patch	2022-02-21 15:22:44.105704157 +0000
@@ -1 +1 @@
-From be8cda4932eb256caaca90090fe0c6d9c756f852 Mon Sep 17 00:00:00 2001
+From ab06c7bf9bbd6276cdeebaf9e4c810823b1839f7 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit be8cda4932eb256caaca90090fe0c6d9c756f852 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list