aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2019-08-14 09:25:52 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2019-08-20 21:22:12 +1000
commit38a0d0cdb46d3f91534e5b9839ec2d67be14c59d (patch)
tree6dfb7e46f2079b44b395fcbf46f6cadda79c7b88
parentpowerpc/kasan: Fix shadow area set up for modules. (diff)
downloadlinux-dev-38a0d0cdb46d3f91534e5b9839ec2d67be14c59d.tar.xz
linux-dev-38a0d0cdb46d3f91534e5b9839ec2d67be14c59d.zip
powerpc/futex: Fix warning: 'oldval' may be used uninitialized in this function
We see warnings such as: kernel/futex.c: In function 'do_futex': kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized] return oldval == cmparg; ^ kernel/futex.c:1651:6: note: 'oldval' was declared here int oldval, ret; ^ This is because arch_futex_atomic_op_inuser() only sets *oval if ret is 0 and GCC doesn't see that it will only use it when ret is 0. Anyway, the non-zero ret path is an error path that won't suffer from setting *oval, and as *oval is a local var in futex_atomic_op_inuser() it will have no impact. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> [mpe: reword change log slightly] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/86b72f0c134367b214910b27b9a6dd3321af93bb.1565774657.git.christophe.leroy@c-s.fr
-rw-r--r--arch/powerpc/include/asm/futex.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h
index 3a6aa57b9d90..eea28ca679db 100644
--- a/arch/powerpc/include/asm/futex.h
+++ b/arch/powerpc/include/asm/futex.h
@@ -60,8 +60,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
pagefault_enable();
- if (!ret)
- *oval = oldval;
+ *oval = oldval;
prevent_write_to_user(uaddr, sizeof(*uaddr));
return ret;