aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-10-25 00:25:31 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-25 00:26:04 -0400
commit0fd0ff01d4c3c01e7fe69b762ee1a13236639acc (patch)
treee40f86d8730edbc2d48abb9c170c2faf6c6a36c1
parent614da3d9685b67917cab48c8452fd8bf93de0867 (diff)
sparc64: Delete now unused user copy fixup functions.
Now that all of the user copy routines are converted to return accurate residual lengths when an exception occurs, we no longer need the broken fixup routines. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/include/asm/uaccess_64.h36
-rw-r--r--arch/sparc/lib/Makefile2
-rw-r--r--arch/sparc/lib/user_fixup.c71
3 files changed, 4 insertions, 105 deletions
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 0244012435c8..5373136c412b 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -188,64 +188,34 @@ int __get_user_bad(void);
188unsigned long __must_check ___copy_from_user(void *to, 188unsigned long __must_check ___copy_from_user(void *to,
189 const void __user *from, 189 const void __user *from,
190 unsigned long size); 190 unsigned long size);
191unsigned long copy_from_user_fixup(void *to, const void __user *from,
192 unsigned long size);
193static inline unsigned long __must_check 191static inline unsigned long __must_check
194copy_from_user(void *to, const void __user *from, unsigned long size) 192copy_from_user(void *to, const void __user *from, unsigned long size)
195{ 193{
196 unsigned long ret;
197
198 check_object_size(to, size, false); 194 check_object_size(to, size, false);
199 195
200 ret = ___copy_from_user(to, from, size); 196 return ___copy_from_user(to, from, size);
201 if (unlikely(ret)) {
202 if ((long)ret < 0)
203 ret = copy_from_user_fixup(to, from, size);
204 return ret;
205 }
206
207 return ret;
208} 197}
209#define __copy_from_user copy_from_user 198#define __copy_from_user copy_from_user
210 199
211unsigned long __must_check ___copy_to_user(void __user *to, 200unsigned long __must_check ___copy_to_user(void __user *to,
212 const void *from, 201 const void *from,
213 unsigned long size); 202 unsigned long size);
214unsigned long copy_to_user_fixup(void __user *to, const void *from,
215 unsigned long size);
216static inline unsigned long __must_check 203static inline unsigned long __must_check
217copy_to_user(void __user *to, const void *from, unsigned long size) 204copy_to_user(void __user *to, const void *from, unsigned long size)
218{ 205{
219 unsigned long ret;
220
221 check_object_size(from, size, true); 206 check_object_size(from, size, true);
222 207
223 ret = ___copy_to_user(to, from, size); 208 return ___copy_to_user(to, from, size);
224 if (unlikely(ret)) {
225 if ((long)ret < 0)
226 ret = copy_to_user_fixup(to, from, size);
227 return ret;
228 }
229 return ret;
230} 209}
231#define __copy_to_user copy_to_user 210#define __copy_to_user copy_to_user
232 211
233unsigned long __must_check ___copy_in_user(void __user *to, 212unsigned long __must_check ___copy_in_user(void __user *to,
234 const void __user *from, 213 const void __user *from,
235 unsigned long size); 214 unsigned long size);
236unsigned long copy_in_user_fixup(void __user *to, void __user *from,
237 unsigned long size);
238static inline unsigned long __must_check 215static inline unsigned long __must_check
239copy_in_user(void __user *to, void __user *from, unsigned long size) 216copy_in_user(void __user *to, void __user *from, unsigned long size)
240{ 217{
241 unsigned long ret = ___copy_in_user(to, from, size); 218 return ___copy_in_user(to, from, size);
242
243 if (unlikely(ret)) {
244 if ((long)ret < 0)
245 ret = copy_in_user_fixup(to, from, size);
246 return ret;
247 }
248 return ret;
249} 219}
250#define __copy_in_user copy_in_user 220#define __copy_in_user copy_in_user
251 221
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 885f00e81d1a..69912d2f8b54 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -38,7 +38,7 @@ lib-$(CONFIG_SPARC64) += NG4patch.o NG4copy_page.o NG4clear_page.o NG4memset.o
38lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o 38lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o
39lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o 39lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
40 40
41lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o 41lib-$(CONFIG_SPARC64) += copy_in_user.o memmove.o
42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o 42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
43 43
44obj-$(CONFIG_SPARC64) += iomap.o 44obj-$(CONFIG_SPARC64) += iomap.o
diff --git a/arch/sparc/lib/user_fixup.c b/arch/sparc/lib/user_fixup.c
deleted file mode 100644
index ac96ae236709..000000000000
--- a/arch/sparc/lib/user_fixup.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/* user_fixup.c: Fix up user copy faults.
2 *
3 * Copyright (C) 2004 David S. Miller <davem@redhat.com>
4 */
5
6#include <linux/compiler.h>
7#include <linux/kernel.h>
8#include <linux/string.h>
9#include <linux/errno.h>
10#include <linux/module.h>
11
12#include <asm/uaccess.h>
13
14/* Calculating the exact fault address when using
15 * block loads and stores can be very complicated.
16 *
17 * Instead of trying to be clever and handling all
18 * of the cases, just fix things up simply here.
19 */
20
21static unsigned long compute_size(unsigned long start, unsigned long size, unsigned long *offset)
22{
23 unsigned long fault_addr = current_thread_info()->fault_address;
24 unsigned long end = start + size;
25
26 if (fault_addr < start || fault_addr >= end) {
27 *offset = 0;
28 } else {
29 *offset = fault_addr - start;
30 size = end - fault_addr;
31 }
32 return size;
33}
34
35unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size)
36{
37 unsigned long offset;
38
39 size = compute_size((unsigned long) from, size, &offset);
40 if (likely(size))
41 memset(to + offset, 0, size);
42
43 return size;
44}
45EXPORT_SYMBOL(copy_from_user_fixup);
46
47unsigned long copy_to_user_fixup(void __user *to, const void *from, unsigned long size)
48{
49 unsigned long offset;
50
51 return compute_size((unsigned long) to, size, &offset);
52}
53EXPORT_SYMBOL(copy_to_user_fixup);
54
55unsigned long copy_in_user_fixup(void __user *to, void __user *from, unsigned long size)
56{
57 unsigned long fault_addr = current_thread_info()->fault_address;
58 unsigned long start = (unsigned long) to;
59 unsigned long end = start + size;
60
61 if (fault_addr >= start && fault_addr < end)
62 return end - fault_addr;
63
64 start = (unsigned long) from;
65 end = start + size;
66 if (fault_addr >= start && fault_addr < end)
67 return end - fault_addr;
68
69 return size;
70}
71EXPORT_SYMBOL(copy_in_user_fixup);