public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic arch_futex_atomic_op_inuser() cleanup
@ 2019-07-15 10:27 Vasily Averin
  2019-07-15 10:27 ` Vasily Averin
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Vasily Averin @ 2019-07-15 10:27 UTC (permalink / raw)
  To: linux-kernel, linux-arch, Thomas Gleixner, Ingo Molnar,
	Arnd Bergmann

Access to 'op' variable does not require pagefault_disable(),
'ret' variable should be initialized before using,
'oldval' variable can be replaced by constant.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 include/asm-generic/futex.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index 8666fe7f35d7..e9a9655d786d 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -118,9 +118,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
 static inline int
 arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
 {
-	int oldval = 0, ret;
-
-	pagefault_disable();
+	int ret = 0;
 
 	switch (op) {
 	case FUTEX_OP_SET:
@@ -132,10 +130,8 @@ arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
 		ret = -ENOSYS;
 	}
 
-	pagefault_enable();
-
 	if (!ret)
-		*oval = oldval;
+		*oval = 0;
 
 	return ret;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-07-16 12:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-15 10:27 [PATCH] generic arch_futex_atomic_op_inuser() cleanup Vasily Averin
2019-07-15 10:27 ` Vasily Averin
2019-07-15 10:29 ` Vasily Averin
2019-07-15 10:29   ` Vasily Averin
2019-07-15 12:06   ` Arnd Bergmann
2019-07-15 12:06     ` Arnd Bergmann
2019-07-15 13:15     ` Thomas Gleixner
2019-07-15 13:15       ` Thomas Gleixner
2019-07-16  6:22       ` [PATCH v2] futex: " Vasily Averin
2019-07-16  6:22         ` Vasily Averin
2019-07-16 12:46         ` Arnd Bergmann
2019-07-16 12:46           ` Arnd Bergmann
2019-07-15 13:13 ` [PATCH] " Thomas Gleixner
2019-07-15 13:13   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox