Skip to content

Commit 1fe67ae

Browse files
ubizjakIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 539615d commit 1fe67ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/include/asm/percpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ do { \
178178
(void)pto_tmp__; \
179179
} \
180180
asm qual(__pcpu_op2_##size("mov", "%[val]", __percpu_arg([var])) \
181-
: [var] "+m" (__my_cpu_var(_var)) \
181+
: [var] "=m" (__my_cpu_var(_var)) \
182182
: [val] __pcpu_reg_imm_##size(pto_val__)); \
183183
} while (0)
184184

0 commit comments

Comments
 (0)