mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 06:49:45 -04:00
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
This commit is contained in:
@@ -178,7 +178,7 @@ do { \
|
||||
(void)pto_tmp__; \
|
||||
} \
|
||||
asm qual(__pcpu_op2_##size("mov", "%[val]", __percpu_arg([var])) \
|
||||
: [var] "+m" (__my_cpu_var(_var)) \
|
||||
: [var] "=m" (__my_cpu_var(_var)) \
|
||||
: [val] __pcpu_reg_imm_##size(pto_val__)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user