x86/percpu: Fix operand constraint modifier in __raw_cpu_write()
authorUros Bizjak <ubizjak@gmail.com>
Tue, 30 Apr 2024 09:17:24 +0000 (11:17 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 18 May 2024 09:18:42 +0000 (11:18 +0200)
commit1fe67aee8ab3fdab4357afc983a9e9ff3892d694
treee8d2c4a53254f488b1ff35762183546bda774a9d
parent539615de7004a46778020183622856f4ca14e4ac
x86/percpu: Fix operand constraint modifier in __raw_cpu_write()

__raw_cpu_write() with !USE_X86_SEG_SUPPORT config uses read/write
operand constraint modifier "+" for its memory location. This signals
the compiler that the location is both read and written by the asm.
This is not true, because MOV insn only writes to the output.

Correct the modifier to "=" to inform the compiler that the memory
location is only written to. This also prevents the compiler from
value tracking the undefined value from the uninitialized memory.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240430091833.196482-5-ubizjak@gmail.com
arch/x86/include/asm/percpu.h