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/s390 | |
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/s390')
-rw-r--r-- | arch/s390/include/asm/futex.h | 10 | ||||
-rw-r--r-- | arch/s390/include/asm/uaccess.h | 4 | ||||
-rw-r--r-- | arch/s390/lib/uaccess.h | 8 | ||||
-rw-r--r-- | arch/s390/lib/uaccess_pt.c | 12 | ||||
-rw-r--r-- | arch/s390/lib/uaccess_std.c | 6 |
5 files changed, 20 insertions, 20 deletions
diff --git a/arch/s390/include/asm/futex.h b/arch/s390/include/asm/futex.h index 27ac515ef59c..81cf36b691f1 100644 --- a/arch/s390/include/asm/futex.h +++ b/arch/s390/include/asm/futex.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/uaccess.h> | 7 | #include <linux/uaccess.h> |
8 | #include <asm/errno.h> | 8 | #include <asm/errno.h> |
9 | 9 | ||
10 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 10 | static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
11 | { | 11 | { |
12 | int op = (encoded_op >> 28) & 7; | 12 | int op = (encoded_op >> 28) & 7; |
13 | int cmp = (encoded_op >> 24) & 15; | 13 | int cmp = (encoded_op >> 24) & 15; |
@@ -18,7 +18,7 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
18 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 18 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
19 | oparg = 1 << oparg; | 19 | oparg = 1 << oparg; |
20 | 20 | ||
21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) |
22 | return -EFAULT; | 22 | return -EFAULT; |
23 | 23 | ||
24 | pagefault_disable(); | 24 | pagefault_disable(); |
@@ -39,10 +39,10 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
39 | return ret; | 39 | return ret; |
40 | } | 40 | } |
41 | 41 | ||
42 | static inline int futex_atomic_cmpxchg_inatomic(int *uval, int __user *uaddr, | 42 | static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
43 | int oldval, int newval) | 43 | u32 oldval, u32 newval) |
44 | { | 44 | { |
45 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 45 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) |
46 | return -EFAULT; | 46 | return -EFAULT; |
47 | 47 | ||
48 | return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval); | 48 | return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval); |
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 549adf6a9b8b..2d9ea11f919a 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h | |||
@@ -83,8 +83,8 @@ struct uaccess_ops { | |||
83 | size_t (*clear_user)(size_t, void __user *); | 83 | size_t (*clear_user)(size_t, void __user *); |
84 | size_t (*strnlen_user)(size_t, const char __user *); | 84 | size_t (*strnlen_user)(size_t, const char __user *); |
85 | size_t (*strncpy_from_user)(size_t, const char __user *, char *); | 85 | size_t (*strncpy_from_user)(size_t, const char __user *, char *); |
86 | int (*futex_atomic_op)(int op, int __user *, int oparg, int *old); | 86 | int (*futex_atomic_op)(int op, u32 __user *, int oparg, int *old); |
87 | int (*futex_atomic_cmpxchg)(int *, int __user *, int old, int new); | 87 | int (*futex_atomic_cmpxchg)(u32 *, u32 __user *, u32 old, u32 new); |
88 | }; | 88 | }; |
89 | 89 | ||
90 | extern struct uaccess_ops uaccess; | 90 | extern struct uaccess_ops uaccess; |
diff --git a/arch/s390/lib/uaccess.h b/arch/s390/lib/uaccess.h index 89a80674e44b..1d2536cb630b 100644 --- a/arch/s390/lib/uaccess.h +++ b/arch/s390/lib/uaccess.h | |||
@@ -12,12 +12,12 @@ extern size_t copy_from_user_std(size_t, const void __user *, void *); | |||
12 | extern size_t copy_to_user_std(size_t, void __user *, const void *); | 12 | extern size_t copy_to_user_std(size_t, void __user *, const void *); |
13 | extern size_t strnlen_user_std(size_t, const char __user *); | 13 | extern size_t strnlen_user_std(size_t, const char __user *); |
14 | extern size_t strncpy_from_user_std(size_t, const char __user *, char *); | 14 | extern size_t strncpy_from_user_std(size_t, const char __user *, char *); |
15 | extern int futex_atomic_cmpxchg_std(int *, int __user *, int, int); | 15 | extern int futex_atomic_cmpxchg_std(u32 *, u32 __user *, u32, u32); |
16 | extern int futex_atomic_op_std(int, int __user *, int, int *); | 16 | extern int futex_atomic_op_std(int, u32 __user *, int, int *); |
17 | 17 | ||
18 | extern size_t copy_from_user_pt(size_t, const void __user *, void *); | 18 | extern size_t copy_from_user_pt(size_t, const void __user *, void *); |
19 | extern size_t copy_to_user_pt(size_t, void __user *, const void *); | 19 | extern size_t copy_to_user_pt(size_t, void __user *, const void *); |
20 | extern int futex_atomic_op_pt(int, int __user *, int, int *); | 20 | extern int futex_atomic_op_pt(int, u32 __user *, int, int *); |
21 | extern int futex_atomic_cmpxchg_pt(int *, int __user *, int, int); | 21 | extern int futex_atomic_cmpxchg_pt(u32 *, u32 __user *, u32, u32); |
22 | 22 | ||
23 | #endif /* __ARCH_S390_LIB_UACCESS_H */ | 23 | #endif /* __ARCH_S390_LIB_UACCESS_H */ |
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index b3cebcd52f5c..74833831417f 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c | |||
@@ -302,7 +302,7 @@ fault: | |||
302 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ | 302 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ |
303 | "m" (*uaddr) : "cc" ); | 303 | "m" (*uaddr) : "cc" ); |
304 | 304 | ||
305 | static int __futex_atomic_op_pt(int op, int __user *uaddr, int oparg, int *old) | 305 | static int __futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old) |
306 | { | 306 | { |
307 | int oldval = 0, newval, ret; | 307 | int oldval = 0, newval, ret; |
308 | 308 | ||
@@ -335,7 +335,7 @@ static int __futex_atomic_op_pt(int op, int __user *uaddr, int oparg, int *old) | |||
335 | return ret; | 335 | return ret; |
336 | } | 336 | } |
337 | 337 | ||
338 | int futex_atomic_op_pt(int op, int __user *uaddr, int oparg, int *old) | 338 | int futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old) |
339 | { | 339 | { |
340 | int ret; | 340 | int ret; |
341 | 341 | ||
@@ -354,8 +354,8 @@ int futex_atomic_op_pt(int op, int __user *uaddr, int oparg, int *old) | |||
354 | return ret; | 354 | return ret; |
355 | } | 355 | } |
356 | 356 | ||
357 | static int __futex_atomic_cmpxchg_pt(int *uval, int __user *uaddr, | 357 | static int __futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr, |
358 | int oldval, int newval) | 358 | u32 oldval, u32 newval) |
359 | { | 359 | { |
360 | int ret; | 360 | int ret; |
361 | 361 | ||
@@ -370,8 +370,8 @@ static int __futex_atomic_cmpxchg_pt(int *uval, int __user *uaddr, | |||
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | 372 | ||
373 | int futex_atomic_cmpxchg_pt(int *uval, int __user *uaddr, | 373 | int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr, |
374 | int oldval, int newval) | 374 | u32 oldval, u32 newval) |
375 | { | 375 | { |
376 | int ret; | 376 | int ret; |
377 | 377 | ||
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c index 1d6643c0b95f..bb1a7eed42ce 100644 --- a/arch/s390/lib/uaccess_std.c +++ b/arch/s390/lib/uaccess_std.c | |||
@@ -255,7 +255,7 @@ size_t strncpy_from_user_std(size_t size, const char __user *src, char *dst) | |||
255 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ | 255 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ |
256 | "m" (*uaddr) : "cc"); | 256 | "m" (*uaddr) : "cc"); |
257 | 257 | ||
258 | int futex_atomic_op_std(int op, int __user *uaddr, int oparg, int *old) | 258 | int futex_atomic_op_std(int op, u32 __user *uaddr, int oparg, int *old) |
259 | { | 259 | { |
260 | int oldval = 0, newval, ret; | 260 | int oldval = 0, newval, ret; |
261 | 261 | ||
@@ -287,8 +287,8 @@ int futex_atomic_op_std(int op, int __user *uaddr, int oparg, int *old) | |||
287 | return ret; | 287 | return ret; |
288 | } | 288 | } |
289 | 289 | ||
290 | int futex_atomic_cmpxchg_std(int *uval, int __user *uaddr, | 290 | int futex_atomic_cmpxchg_std(u32 *uval, u32 __user *uaddr, |
291 | int oldval, int newval) | 291 | u32 oldval, u32 newval) |
292 | { | 292 | { |
293 | int ret; | 293 | int ret; |
294 | 294 | ||