]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.10/sparc64-delete-now-unused-user-copy-fixup-functions.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.10 / sparc64-delete-now-unused-user-copy-fixup-functions.patch
1 From foo@baz Sat Nov 19 09:52:59 CET 2016
2 From: "David S. Miller" <davem@davemloft.net>
3 Date: Mon, 24 Oct 2016 21:25:31 -0700
4 Subject: sparc64: Delete now unused user copy fixup functions.
5
6 From: "David S. Miller" <davem@davemloft.net>
7
8
9 [ Upstream commit 0fd0ff01d4c3c01e7fe69b762ee1a13236639acc ]
10
11 Now that all of the user copy routines are converted to return
12 accurate residual lengths when an exception occurs, we no longer need
13 the broken fixup routines.
14
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 ---
18 arch/sparc/include/asm/uaccess_64.h | 36 +-----------------
19 arch/sparc/lib/Makefile | 2 -
20 arch/sparc/lib/user_fixup.c | 71 ------------------------------------
21 3 files changed, 4 insertions(+), 105 deletions(-)
22 delete mode 100644 arch/sparc/lib/user_fixup.c
23
24 --- a/arch/sparc/include/asm/uaccess_64.h
25 +++ b/arch/sparc/include/asm/uaccess_64.h
26 @@ -204,64 +204,34 @@ int __get_user_bad(void);
27 unsigned long __must_check ___copy_from_user(void *to,
28 const void __user *from,
29 unsigned long size);
30 -unsigned long copy_from_user_fixup(void *to, const void __user *from,
31 - unsigned long size);
32 static inline unsigned long __must_check
33 copy_from_user(void *to, const void __user *from, unsigned long size)
34 {
35 - unsigned long ret;
36 -
37 check_object_size(to, size, false);
38
39 - ret = ___copy_from_user(to, from, size);
40 - if (unlikely(ret)) {
41 - if ((long)ret < 0)
42 - ret = copy_from_user_fixup(to, from, size);
43 - return ret;
44 - }
45 -
46 - return ret;
47 + return ___copy_from_user(to, from, size);
48 }
49 #define __copy_from_user copy_from_user
50
51 unsigned long __must_check ___copy_to_user(void __user *to,
52 const void *from,
53 unsigned long size);
54 -unsigned long copy_to_user_fixup(void __user *to, const void *from,
55 - unsigned long size);
56 static inline unsigned long __must_check
57 copy_to_user(void __user *to, const void *from, unsigned long size)
58 {
59 - unsigned long ret;
60 -
61 check_object_size(from, size, true);
62
63 - ret = ___copy_to_user(to, from, size);
64 - if (unlikely(ret)) {
65 - if ((long)ret < 0)
66 - ret = copy_to_user_fixup(to, from, size);
67 - return ret;
68 - }
69 - return ret;
70 + return ___copy_to_user(to, from, size);
71 }
72 #define __copy_to_user copy_to_user
73
74 unsigned long __must_check ___copy_in_user(void __user *to,
75 const void __user *from,
76 unsigned long size);
77 -unsigned long copy_in_user_fixup(void __user *to, void __user *from,
78 - unsigned long size);
79 static inline unsigned long __must_check
80 copy_in_user(void __user *to, void __user *from, unsigned long size)
81 {
82 - unsigned long ret = ___copy_in_user(to, from, size);
83 -
84 - if (unlikely(ret)) {
85 - if ((long)ret < 0)
86 - ret = copy_in_user_fixup(to, from, size);
87 - return ret;
88 - }
89 - return ret;
90 + return ___copy_in_user(to, from, size);
91 }
92 #define __copy_in_user copy_in_user
93
94 --- a/arch/sparc/lib/Makefile
95 +++ b/arch/sparc/lib/Makefile
96 @@ -38,7 +38,7 @@ lib-$(CONFIG_SPARC64) += NG4patch.o NG4
97 lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o
98 lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
99
100 -lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
101 +lib-$(CONFIG_SPARC64) += copy_in_user.o memmove.o
102 lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
103
104 obj-$(CONFIG_SPARC64) += iomap.o
105 --- a/arch/sparc/lib/user_fixup.c
106 +++ /dev/null
107 @@ -1,71 +0,0 @@
108 -/* user_fixup.c: Fix up user copy faults.
109 - *
110 - * Copyright (C) 2004 David S. Miller <davem@redhat.com>
111 - */
112 -
113 -#include <linux/compiler.h>
114 -#include <linux/kernel.h>
115 -#include <linux/string.h>
116 -#include <linux/errno.h>
117 -#include <linux/module.h>
118 -
119 -#include <asm/uaccess.h>
120 -
121 -/* Calculating the exact fault address when using
122 - * block loads and stores can be very complicated.
123 - *
124 - * Instead of trying to be clever and handling all
125 - * of the cases, just fix things up simply here.
126 - */
127 -
128 -static unsigned long compute_size(unsigned long start, unsigned long size, unsigned long *offset)
129 -{
130 - unsigned long fault_addr = current_thread_info()->fault_address;
131 - unsigned long end = start + size;
132 -
133 - if (fault_addr < start || fault_addr >= end) {
134 - *offset = 0;
135 - } else {
136 - *offset = fault_addr - start;
137 - size = end - fault_addr;
138 - }
139 - return size;
140 -}
141 -
142 -unsigned long copy_from_user_fixup(void *to, const void __user *from, unsigned long size)
143 -{
144 - unsigned long offset;
145 -
146 - size = compute_size((unsigned long) from, size, &offset);
147 - if (likely(size))
148 - memset(to + offset, 0, size);
149 -
150 - return size;
151 -}
152 -EXPORT_SYMBOL(copy_from_user_fixup);
153 -
154 -unsigned long copy_to_user_fixup(void __user *to, const void *from, unsigned long size)
155 -{
156 - unsigned long offset;
157 -
158 - return compute_size((unsigned long) to, size, &offset);
159 -}
160 -EXPORT_SYMBOL(copy_to_user_fixup);
161 -
162 -unsigned long copy_in_user_fixup(void __user *to, void __user *from, unsigned long size)
163 -{
164 - unsigned long fault_addr = current_thread_info()->fault_address;
165 - unsigned long start = (unsigned long) to;
166 - unsigned long end = start + size;
167 -
168 - if (fault_addr >= start && fault_addr < end)
169 - return end - fault_addr;
170 -
171 - start = (unsigned long) from;
172 - end = start + size;
173 - if (fault_addr >= start && fault_addr < end)
174 - return end - fault_addr;
175 -
176 - return size;
177 -}
178 -EXPORT_SYMBOL(copy_in_user_fixup);