From: Uros Bizjak Date: Tue, 30 Apr 2024 09:17:24 +0000 (+0200) Subject: x86/percpu: Fix operand constraint modifier in __raw_cpu_write() X-Git-Tag: v6.11-rc1~127^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1fe67aee8ab3fdab4357afc983a9e9ff3892d694;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Josh Poimboeuf Cc: Linus Torvalds Link: https://lore.kernel.org/r/20240430091833.196482-5-ubizjak@gmail.com --- diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index d20255138426f..c77393cd02731 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -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)