From: Heiko Carstens Date: Mon, 9 Jan 2023 10:51:20 +0000 (+0100) Subject: s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple() X-Git-Tag: v6.6.7~3638^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3f360db08d55a14112bd27454e616a24296a8b0;p=platform%2Fkernel%2Flinux-starfive.git s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple() Make sure that *ptr__ within arch_this_cpu_to_op_simple() is only dereferenced once by using READ_ONCE(). Otherwise the compiler could generate incorrect code. Cc: Reviewed-by: Alexander Gordeev Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index cb5fc06..081837b 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h @@ -31,7 +31,7 @@ pcp_op_T__ *ptr__; \ preempt_disable_notrace(); \ ptr__ = raw_cpu_ptr(&(pcp)); \ - prev__ = *ptr__; \ + prev__ = READ_ONCE(*ptr__); \ do { \ old__ = prev__; \ new__ = old__ op (val); \