]> Gentwo Git Trees - linux/.git/commit
atomic: Skip alignment check for try_cmpxchg() old arg
authorArnd Bergmann <arnd@arndb.de>
Mon, 6 Oct 2025 11:07:32 +0000 (13:07 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 21 Oct 2025 10:31:56 +0000 (12:31 +0200)
commit44472d1b83127e579c798ff92a07ae86d98b61b9
tree01b95e151cc4b6164b1acd8416448c3109ca27d1
parent66f1ea83d9f8346324fc50779944297d778cac95
atomic: Skip alignment check for try_cmpxchg() old arg

The 'old' argument in atomic_try_cmpxchg() and related functions is a
pointer to a normal non-atomic integer number, which does not require
to be naturally aligned, unlike the atomic_t/atomic64_t types themselves.

In order to add an alignment check with CONFIG_DEBUG_ATOMIC into the
normal instrument_atomic_read_write() helper, change this check to use
the non-atomic instrument_read_write(), the same way that was done
earlier for try_cmpxchg() in commit ec570320b09f ("locking/atomic:
Correct (cmp)xchg() instrumentation").

This prevents warnings on m68k calling the 32-bit atomic_try_cmpxchg()
with 16-bit aligned arguments as well as several more architectures
including x86-32 when calling atomic64_try_cmpxchg() with 32-bit
aligned u64 arguments.

Reported-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/cover.1757810729.git.fthain@linux-m68k.org/
include/linux/atomic/atomic-instrumented.h
scripts/atomic/gen-atomic-instrumented.sh