[PATCH] riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg

patchwork-bot+linux-riscv at kernel.org patchwork-bot+linux-riscv at kernel.org
Thu Feb 13 10:30:43 PST 2025


Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer at rivosinc.com>:

On Thu, 30 Jan 2025 10:25:38 +0100 you wrote:
> Sign extend also an unsigned compare value to match what lr.w is doing.
> Otherwise try_cmpxchg may spuriously return true when used on a u32 value
> that has the sign bit set, as it happens often in inode_set_ctime_current.
> 
> Do this in three conversion steps.  The first conversion to long is needed
> to avoid a -Wpointer-to-int-cast warning when arch_cmpxchg is used with a
> pointer type.  Then convert to int and back to long to always sign extend
> the 32-bit value to 64-bit.
> 
> [...]

Here is the summary with links:
  - riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg
    https://git.kernel.org/riscv/c/431a3bbd3249

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html





More information about the linux-riscv mailing list