patch 'bitops: clarify power-of-two alignment limits' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:06:22 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. 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/779a45a0a8135998c39e29d61f8923fa172586f5
Thanks.
Kevin
---
>From 779a45a0a8135998c39e29d61f8923fa172586f5 Mon Sep 17 00:00:00 2001
From: Jack Bond-Preston <jack.bond-preston at foss.arm.com>
Date: Mon, 16 Nov 2026 14:37:59 +0000
Subject: [PATCH] bitops: clarify power-of-two alignment limits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ upstream commit c3377176033715a1487228e111cd7129caa00888 ]
rte_align32pow2 and rte_align62pow2 will overflow and return incorrect
values for input values exceeding 1<<31 and 1<<63, respectively. There
is no way to return a valid result here: the next power of two above
these values is unrepresentable with 32/64 bit unsigned integers.
Adjust the documentation for these functions to clarify that input
values above these limits will return invalid results, and thus should
not be provided to these functions. Additionally, document an existing
edge case of the implementation: when the input is 0, it returns 0 (not
a power of 2).
Fixes: 7253e3d2a5b6 ("bitops: move bit count functions")
Reported-by: Mark Bulatov <ms.bulatov7 at gmail.com>
Signed-off-by: Jack Bond-Preston <jack.bond-preston at foss.arm.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
---
lib/eal/include/rte_bitops.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h
index b170447714..bb57b53201 100644
--- a/lib/eal/include/rte_bitops.h
+++ b/lib/eal/include/rte_bitops.h
@@ -1318,8 +1318,14 @@ rte_is_power_of_2(uint32_t n)
*
* @param x
- * The integer value to align
+ * The integer value to align.
+ * Must be less than or equal to 1 << 31 (0x80000000).
*
* @return
- * The smallest power of 2 which is greater than or equal to @c x.
+ * The smallest power of 2 which is greater than or equal to @c x,
+ * or 0 if @c x is 0.
+ *
+ * @note If the input parameter exceeds 1 << 31 (0x80000000),
+ * then the expected result is unrepresentable and the return value is invalid.
+ * @note For the input value 0, this function returns 0, which is not a power of 2.
*/
static inline uint32_t
@@ -1353,8 +1359,14 @@ rte_align32prevpow2(uint32_t x)
*
* @param v
- * The 64b value to align
+ * The 64b value to align.
+ * Must be less than or equal to 1 << 63 (0x8000000000000000).
*
* @return
- * The smallest power of 2 which is greater than or equal to @c v.
+ * The smallest power of 2 which is greater than or equal to @c v,
+ * or 0 if @c v is 0.
+ *
+ * @note If the input parameter exceeds 1 << 63 (0x8000000000000000),
+ * then the expected result is unrepresentable and the return value is invalid.
+ * @note For the input value 0, this function returns 0, which is not a power of 2.
*/
static inline uint64_t
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:52.060916811 +0000
+++ 0456-bitops-clarify-power-of-two-alignment-limits.patch 2026-12-03 12:52:39.341961765 +0000
@@ -1 +1 @@
-From c3377176033715a1487228e111cd7129caa00888 Mon Sep 17 00:00:00 2001
+From 779a45a0a8135998c39e29d61f8923fa172586f5 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit c3377176033715a1487228e111cd7129caa00888 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 45255b68aa..24119c77be 100644
+index b170447714..bb57b53201 100644
@@ -34 +35 @@
-@@ -1262,8 +1262,14 @@ rte_is_power_of_2(uint32_t n)
+@@ -1318,8 +1318,14 @@ rte_is_power_of_2(uint32_t n)
@@ -51 +52 @@
-@@ -1297,8 +1303,14 @@ rte_align32prevpow2(uint32_t x)
+@@ -1353,8 +1359,14 @@ rte_align32prevpow2(uint32_t x)
More information about the stable
mailing list