Skip to content

Commit bd2049f

Browse files
committed
Merge tag 'locking-urgent-2020-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fix from Thomas Gleixner: "A single fix for the fallout of the recent futex uacess rework. With those changes GCC9 fails to analyze arch_futex_atomic_op_inuser() correctly and emits a 'maybe unitialized' warning. While we usually ignore compiler stupidity the conditional store is pointless anyway because the correct case has to store. For the fault case the extra store does no harm" * tag 'locking-urgent-2020-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: ARM: futex: Address build warning
2 parents 27d2dcb + 8101b5a commit bd2049f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/arm/include/asm/futex.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
165165
preempt_enable();
166166
#endif
167167

168-
if (!ret)
169-
*oval = oldval;
168+
/*
169+
* Store unconditionally. If ret != 0 the extra store is the least
170+
* of the worries but GCC cannot figure out that __futex_atomic_op()
171+
* is either setting ret to -EFAULT or storing the old value in
172+
* oldval which results in a uninitialized warning at the call site.
173+
*/
174+
*oval = oldval;
170175

171176
return ret;
172177
}

0 commit comments

Comments
 (0)