[dpdk-stable] patch 'eal: fix parentheses in alignment macros' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:26 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/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 f5f37e8889243b92cc325817c7f72849b37f818a Mon Sep 17 00:00:00 2001
From: Harman Kalra <hkalra at marvell.com>
Date: Wed, 24 Jun 2020 15:50:47 +0530
Subject: [PATCH] eal: fix parentheses in alignment macros

[ upstream commit 3596a037ab44a1ad588fb388d5d4ee8f3d2a1ca7 ]

Found an issue while using RTE_ALIGN_MUL_NEAR with an
expression, like as passed in estimate_tsc_freq().
RTE_ALIGN_MUL_FLOOR resulted in unexpected value as
parathesis are required to evaluate an expression.

Fixes: 5120203d753f ("eal: add macros to align value to multiple")

Signed-off-by: Harman Kalra <hkalra at marvell.com>
---
 lib/librte_eal/common/include/rte_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 41e2778ec..fe7539af2 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -245,7 +245,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
  * than the first parameter.
  */
 #define RTE_ALIGN_MUL_CEIL(v, mul) \
-	(((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul))
+	((((v) + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul))
 
 /**
  * Macro to align a value to the multiple of given value. The resultant
@@ -253,7 +253,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
  * than the first parameter.
  */
 #define RTE_ALIGN_MUL_FLOOR(v, mul) \
-	((v / ((typeof(v))(mul))) * (typeof(v))(mul))
+	(((v) / ((typeof(v))(mul))) * (typeof(v))(mul))
 
 /**
  * Macro to align value to the nearest multiple of the given value.
@@ -264,7 +264,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 	({							\
 		typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul);	\
 		typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul);	\
-		(ceil - v) > (v - floor) ? floor : ceil;	\
+		(ceil - (v)) > ((v) - floor) ? floor : ceil;	\
 	})
 
 /**
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:53.467756775 +0100
+++ 0128-eal-fix-parentheses-in-alignment-macros.patch	2020-07-24 12:53:48.423008994 +0100
@@ -1,26 +1,27 @@
-From 3596a037ab44a1ad588fb388d5d4ee8f3d2a1ca7 Mon Sep 17 00:00:00 2001
+From f5f37e8889243b92cc325817c7f72849b37f818a Mon Sep 17 00:00:00 2001
 From: Harman Kalra <hkalra at marvell.com>
 Date: Wed, 24 Jun 2020 15:50:47 +0530
 Subject: [PATCH] eal: fix parentheses in alignment macros
 
+[ upstream commit 3596a037ab44a1ad588fb388d5d4ee8f3d2a1ca7 ]
+
 Found an issue while using RTE_ALIGN_MUL_NEAR with an
 expression, like as passed in estimate_tsc_freq().
 RTE_ALIGN_MUL_FLOOR resulted in unexpected value as
 parathesis are required to evaluate an expression.
 
 Fixes: 5120203d753f ("eal: add macros to align value to multiple")
-Cc: stable at dpdk.org
 
 Signed-off-by: Harman Kalra <hkalra at marvell.com>
 ---
- lib/librte_eal/include/rte_common.h | 6 +++---
+ lib/librte_eal/common/include/rte_common.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
-diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h
-index 586f815c5..8f487a563 100644
---- a/lib/librte_eal/include/rte_common.h
-+++ b/lib/librte_eal/include/rte_common.h
-@@ -304,7 +304,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
+diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
+index 41e2778ec..fe7539af2 100644
+--- a/lib/librte_eal/common/include/rte_common.h
++++ b/lib/librte_eal/common/include/rte_common.h
+@@ -245,7 +245,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
   * than the first parameter.
   */
  #define RTE_ALIGN_MUL_CEIL(v, mul) \
@@ -29,7 +30,7 @@
  
  /**
   * Macro to align a value to the multiple of given value. The resultant
-@@ -312,7 +312,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
+@@ -253,7 +253,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
   * than the first parameter.
   */
  #define RTE_ALIGN_MUL_FLOOR(v, mul) \
@@ -38,7 +39,7 @@
  
  /**
   * Macro to align value to the nearest multiple of the given value.
-@@ -323,7 +323,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
+@@ -264,7 +264,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
  	({							\
  		typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul);	\
  		typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul);	\


More information about the stable mailing list