Skip to content

Commit

Permalink
s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple()
Browse files Browse the repository at this point in the history
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: <[email protected]>
Reviewed-by: Alexander Gordeev <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
  • Loading branch information
hcahca committed Jan 11, 2023
1 parent 82d3edb commit e3f360d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/include/asm/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down

0 comments on commit e3f360d

Please sign in to comment.