aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-04-27 09:31:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-05-14 08:50:27 -0400
commitd0aab922b19aaaef13c946236cc71ab9b7f895ee (patch)
tree51ea4fa3c4f63771cd4673b3e7702e8af26134cb /arch
parent1699e5c9c414f0e3b393eb87c4acfc319fe7a1c4 (diff)
MIPS: Make access_ok() sideeffect proof.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/uaccess.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 09ff5bb17445..42b9cec2ee96 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -104,11 +104,21 @@
104 104
105#define __access_mask get_fs().seg 105#define __access_mask get_fs().seg
106 106
107#define __access_ok(addr, size, mask) \ 107#define __access_ok(addr, size, mask) \
108 (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0) 108({ \
109 const volatile void __user *__up = addr; \
110 unsigned long __addr = (unsigned long) __up; \
111 unsigned long __size = size; \
112 unsigned long __mask = mask; \
113 unsigned long __ok; \
114 \
115 __ok = (signed long)(__mask & (__addr | (__addr + __size) | \
116 __ua_size(__size))); \
117 __ok == 0; \
118})
109 119
110#define access_ok(type, addr, size) \ 120#define access_ok(type, addr, size) \
111 likely(__access_ok((unsigned long)(addr), (size), __access_mask)) 121 likely(__access_ok((addr), (size), __access_mask))
112 122
113/* 123/*
114 * put_user: - Write a simple value into user space. 124 * put_user: - Write a simple value into user space.