diff options
| author | Andreas Schwab <[email protected]> | 2025-01-30 09:25:38 +0000 |
|---|---|---|
| committer | Palmer Dabbelt <[email protected]> | 2025-02-14 21:06:23 +0000 |
| commit | 1898300abf3508bca152e65b36cce5bf93d7e63e (patch) | |
| tree | 7e5dfa811916616d4599fcb72e61c0da1e5dcf1d /net/switchdev/switchdev.c | |
| parent | riscv: cpufeature: use bitmap_equal() instead of memcmp() (diff) | |
| download | kernel-1898300abf3508bca152e65b36cce5bf93d7e63e.tar.gz kernel-1898300abf3508bca152e65b36cce5bf93d7e63e.zip | |
riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg
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.
Fixes: 6c58f25e6938 ("riscv/atomic: Fix sign extension for RV64I")
Signed-off-by: Andreas Schwab <[email protected]>
Reviewed-by: Alexandre Ghiti <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Tested-by: Xi Ruoyao <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
Diffstat (limited to 'net/switchdev/switchdev.c')
0 files changed, 0 insertions, 0 deletions
