diff options
author | Andreas Schwab <schwab@suse.de> | 2025-01-30 10:25:38 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 18:27:14 +0100 |
commit | 8054065a7bd1a20323b2ca38433f3765ceef864b (patch) | |
tree | 33dda4ca222a01160d283863d1c06604630de7e9 /tools/perf/scripts/python/stackcollapse.py | |
parent | 294a7a9bcef24379d198f0bb88623f9e35bff0e3 (diff) |
riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg
commit 1898300abf3508bca152e65b36cce5bf93d7e63e upstream.
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 <schwab@suse.de>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Tested-by: Xi Ruoyao <xry111@xry111.site>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/mvmed0k4prh.fsf@suse.de
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions