[dpdk-stable] patch 'net/mlx: fix build with clang 9' has been queued to stable release 19.11.1

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Feb 11 12:19:10 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.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/13/20. 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.

Thanks.

Luca Boccassi

---
>From 91a56fda7ef201133fb23fb53cd0f03fbf72ac38 Mon Sep 17 00:00:00 2001
From: Ali Alnubani <alialnu at mellanox.com>
Date: Wed, 11 Dec 2019 06:49:25 +0000
Subject: [PATCH] net/mlx: fix build with clang 9

[ upstream commit c3e89f69facbbfe131b6a6723665d48801ac943d ]

This rewrites the MKSTR macro appending an empty string to its arguments
to resolve build failures similar to:

  drivers/net/mlx4/mlx4.c:461:14: fatal error: format string is not a
  string literal [-Wformat-nonliteral]
          MKSTR(path, "%s/device/uevent", device->ibdev_path);

  drivers/net/mlx4/mlx4_utils.h:82:30: note: expanded from macro 'MKSTR'
          char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \

  drivers/net/mlx5/mlx5_stats.c:144:15: fatal error: format string is not a
  string literal [-Wformat-nonliteral]
  	MKSTR(path, "%s/ports/%d/hw_counters/%s",

  drivers/net/mlx5/mlx5_utils.h:149:30: note: expanded from macro 'MKSTR'
  	char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \

The errors reproduce with clang version 9.0.0, and the release notes
don't mention what could have caused them.

Fixes: 7fae69eeff13 ("mlx4: new poll mode driver")
Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")

Signed-off-by: Ali Alnubani <alialnu at mellanox.com>
Signed-off-by: Matan Azrad <matan at mellanox.com>
---
 drivers/net/mlx4/mlx4_utils.h | 5 +++--
 drivers/net/mlx5/mlx5_utils.h | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index 74b9d2ecdc..5718b9c742 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -79,9 +79,10 @@ pmd_drv_log_basename(const char *s)
 
 /** Allocate a buffer on the stack and fill it with a printf format string. */
 #define MKSTR(name, ...) \
-	char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \
+	int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \
+	char name[mkstr_size_##name + 1]; \
 	\
-	snprintf(name, sizeof(name), __VA_ARGS__)
+	snprintf(name, sizeof(name), "" __VA_ARGS__)
 
 /** Generate a string out of the provided arguments. */
 #define MLX4_STR(...) # __VA_ARGS__
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index b4ed8c6dad..ebf79b80a4 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -146,9 +146,10 @@ extern int mlx5_logtype;
 
 /* Allocate a buffer on the stack and fill it with a printf format string. */
 #define MKSTR(name, ...) \
-	char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \
+	int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \
+	char name[mkstr_size_##name + 1]; \
 	\
-	snprintf(name, sizeof(name), __VA_ARGS__)
+	snprintf(name, sizeof(name), "" __VA_ARGS__)
 
 /**
  * Return logarithm of the nearest power of two above input value.
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-11 11:17:39.047123217 +0000
+++ 0004-net-mlx-fix-build-with-clang-9.patch	2020-02-11 11:17:38.303999552 +0000
@@ -1,8 +1,10 @@
-From c3e89f69facbbfe131b6a6723665d48801ac943d Mon Sep 17 00:00:00 2001
+From 91a56fda7ef201133fb23fb53cd0f03fbf72ac38 Mon Sep 17 00:00:00 2001
 From: Ali Alnubani <alialnu at mellanox.com>
 Date: Wed, 11 Dec 2019 06:49:25 +0000
 Subject: [PATCH] net/mlx: fix build with clang 9
 
+[ upstream commit c3e89f69facbbfe131b6a6723665d48801ac943d ]
+
 This rewrites the MKSTR macro appending an empty string to its arguments
 to resolve build failures similar to:
 
@@ -25,7 +27,6 @@
 
 Fixes: 7fae69eeff13 ("mlx4: new poll mode driver")
 Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ali Alnubani <alialnu at mellanox.com>
 Signed-off-by: Matan Azrad <matan at mellanox.com>


More information about the stable mailing list