[PATCH 1/1] rcu: fix implicit conversion in bit shift

Kevin Traynor ktraynor at redhat.com
Wed Dec 4 12:38:00 CET 2024


On 02/12/2024 18:46, Andre Muezerie wrote:
> [ upstream commit ffe827f38e6e0be8a307d7ef9c0e1347874f0af7 ]
> 
> ../lib/rcu/rte_rcu_qsbr.c(101): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> ../lib/rcu/rte_rcu_qsbr.c(107): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> ../lib/rcu/rte_rcu_qsbr.c(145): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> 
> These warnings are being issued by the MSVC compiler. Since the result is
> being stored in a variable of type uint64_t, it makes sense to shift a
> 64-bit number instead of shifting a 32-bit number and then having the
> compiler to convert the result implicitly to 64 bits.
> UINT64_C was used in the fix as it is the portable way to define a 64-bit
> constant (ULL suffix is architecture dependent).
> 
> From reading the code this is also a bugfix:
> (1 << id), where id = thread_id & 0x3f, was wrong when thread_id > 0x1f.
> 
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---
>  lib/rcu/rte_rcu_qsbr.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 

Hi Andre, thanks for rebasing. This is now applied and pushed to 21.11
branch.
Kevin.



More information about the stable mailing list