[PATCH v3] bitops: document max input value for rte_align[32, 64]pow2

Thomas Monjalon thomas at monjalon.net
Thu Nov 19 01:00:01 CET 2026


16/11/2026 15:37, Jack Bond-Preston:
> 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")
> Cc: stable at dpdk.org
> 
> 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>

Applied, thanks.





More information about the dev mailing list