diff options
author | Michel Lespinasse <walken@google.com> | 2011-03-10 21:50:58 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-03-11 06:23:31 -0500 |
commit | 8d7718aa082aaf30a0b4989e1f04858952f941bc (patch) | |
tree | f006a565d138cec2b497c2bd619f570ad1a11f6e /arch/sh/include | |
parent | 37a9d912b24f96a0591773e6e6c3642991ae5a70 (diff) |
futex: Sanitize futex ops argument types
Change futex_atomic_op_inuser and futex_atomic_cmpxchg_inatomic
prototypes to use u32 types for the futex as this is the data type the
futex core code uses all over the place.
Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Darren Hart <darren@dvhart.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <20110311025058.GD26122@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/sh/include')
-rw-r--r-- | arch/sh/include/asm/futex-irq.h | 19 | ||||
-rw-r--r-- | arch/sh/include/asm/futex.h | 10 |
2 files changed, 15 insertions, 14 deletions
diff --git a/arch/sh/include/asm/futex-irq.h b/arch/sh/include/asm/futex-irq.h index 7b701cbd1e84..6cb9f193a95e 100644 --- a/arch/sh/include/asm/futex-irq.h +++ b/arch/sh/include/asm/futex-irq.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <asm/system.h> | 4 | #include <asm/system.h> |
5 | 5 | ||
6 | static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr, | 6 | static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr, |
7 | int *oldval) | 7 | int *oldval) |
8 | { | 8 | { |
9 | unsigned long flags; | 9 | unsigned long flags; |
@@ -20,7 +20,7 @@ static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr, | |||
20 | return ret; | 20 | return ret; |
21 | } | 21 | } |
22 | 22 | ||
23 | static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr, | 23 | static inline int atomic_futex_op_xchg_add(int oparg, u32 __user *uaddr, |
24 | int *oldval) | 24 | int *oldval) |
25 | { | 25 | { |
26 | unsigned long flags; | 26 | unsigned long flags; |
@@ -37,7 +37,7 @@ static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr, | |||
37 | return ret; | 37 | return ret; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr, | 40 | static inline int atomic_futex_op_xchg_or(int oparg, u32 __user *uaddr, |
41 | int *oldval) | 41 | int *oldval) |
42 | { | 42 | { |
43 | unsigned long flags; | 43 | unsigned long flags; |
@@ -54,7 +54,7 @@ static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr, | |||
54 | return ret; | 54 | return ret; |
55 | } | 55 | } |
56 | 56 | ||
57 | static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr, | 57 | static inline int atomic_futex_op_xchg_and(int oparg, u32 __user *uaddr, |
58 | int *oldval) | 58 | int *oldval) |
59 | { | 59 | { |
60 | unsigned long flags; | 60 | unsigned long flags; |
@@ -71,7 +71,7 @@ static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr, | |||
71 | return ret; | 71 | return ret; |
72 | } | 72 | } |
73 | 73 | ||
74 | static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr, | 74 | static inline int atomic_futex_op_xchg_xor(int oparg, u32 __user *uaddr, |
75 | int *oldval) | 75 | int *oldval) |
76 | { | 76 | { |
77 | unsigned long flags; | 77 | unsigned long flags; |
@@ -88,12 +88,13 @@ static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr, | |||
88 | return ret; | 88 | return ret; |
89 | } | 89 | } |
90 | 90 | ||
91 | static inline int atomic_futex_op_cmpxchg_inatomic(int *uval, | 91 | static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval, |
92 | int __user *uaddr, | 92 | u32 __user *uaddr, |
93 | int oldval, int newval) | 93 | u32 oldval, u32 newval) |
94 | { | 94 | { |
95 | unsigned long flags; | 95 | unsigned long flags; |
96 | int ret, prev = 0; | 96 | int ret; |
97 | u32 prev = 0; | ||
97 | 98 | ||
98 | local_irq_save(flags); | 99 | local_irq_save(flags); |
99 | 100 | ||
diff --git a/arch/sh/include/asm/futex.h b/arch/sh/include/asm/futex.h index a8a5125dc9b4..7be39a646fbd 100644 --- a/arch/sh/include/asm/futex.h +++ b/arch/sh/include/asm/futex.h | |||
@@ -10,7 +10,7 @@ | |||
10 | /* XXX: UP variants, fix for SH-4A and SMP.. */ | 10 | /* XXX: UP variants, fix for SH-4A and SMP.. */ |
11 | #include <asm/futex-irq.h> | 11 | #include <asm/futex-irq.h> |
12 | 12 | ||
13 | static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | 13 | static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) |
14 | { | 14 | { |
15 | int op = (encoded_op >> 28) & 7; | 15 | int op = (encoded_op >> 28) & 7; |
16 | int cmp = (encoded_op >> 24) & 15; | 16 | int cmp = (encoded_op >> 24) & 15; |
@@ -21,7 +21,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | |||
21 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 21 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
22 | oparg = 1 << oparg; | 22 | oparg = 1 << oparg; |
23 | 23 | ||
24 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 24 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) |
25 | return -EFAULT; | 25 | return -EFAULT; |
26 | 26 | ||
27 | pagefault_disable(); | 27 | pagefault_disable(); |
@@ -65,10 +65,10 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | static inline int | 67 | static inline int |
68 | futex_atomic_cmpxchg_inatomic(int *uval, int __user *uaddr, | 68 | futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
69 | int oldval, int newval) | 69 | u32 oldval, u32 newval) |
70 | { | 70 | { |
71 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 71 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) |
72 | return -EFAULT; | 72 | return -EFAULT; |
73 | 73 | ||
74 | return atomic_futex_op_cmpxchg_inatomic(uval, uaddr, oldval, newval); | 74 | return atomic_futex_op_cmpxchg_inatomic(uval, uaddr, oldval, newval); |