[PATCH] bitops: fix integer overflow in align64pow2
Bulatov Mark
ms.bulatov7 at gmail.com
Fri Nov 13 15:13:07 CET 2026
If the function rte_combine64ms1b() returns the maximum possible uint64_t
value, it will result in an overflow.
To avoid this, add a check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 7253e3d2a5 ("bitops: move bit count functions")
Cc: stable at dpdk.org
Signed-off-by: Alexey Simakov <bigalex934 at gmail.com>
Signed-off-by: Mark Bulatov <ms.bulatov7 at gmail.com>
---
lib/eal/include/rte_bitops.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h
index 45255b68aa..d2ed0c3c61 100644
--- a/lib/eal/include/rte_bitops.h
+++ b/lib/eal/include/rte_bitops.h
@@ -1307,6 +1307,9 @@ rte_align64pow2(uint64_t v)
v--;
v = rte_combine64ms1b(v);
+ if (v == UINT64_MAX)
+ v--;
+
return v + 1;
}
--
2.39.5
More information about the dev
mailing list