This is a test repository.
修订版 | 38696e33e2bdf91cbbc7a2291dc6db862d9dfd42 (tree) |
---|---|
时间 | 2020-06-04 06:01:23 |
作者 | Linus Torvalds <torvalds@linu...> |
Commiter | Linus Torvalds |
Merge tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa
Pull Xtensa updates from Max Filippov:
* tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa:
@@ -84,7 +84,7 @@ extern long __put_user_bad(void); | ||
84 | 84 | #define __put_user_check(x, ptr, size) \ |
85 | 85 | ({ \ |
86 | 86 | long __pu_err = -EFAULT; \ |
87 | - __typeof__(*(ptr)) *__pu_addr = (ptr); \ | |
87 | + __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | |
88 | 88 | if (access_ok(__pu_addr, size)) \ |
89 | 89 | __put_user_size((x), __pu_addr, (size), __pu_err); \ |
90 | 90 | __pu_err; \ |
@@ -180,11 +180,11 @@ __asm__ __volatile__( \ | ||
180 | 180 | #define __get_user_check(x, ptr, size) \ |
181 | 181 | ({ \ |
182 | 182 | long __gu_err = -EFAULT; \ |
183 | - const __typeof__(*(ptr)) *__gu_addr = (ptr); \ | |
183 | + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ | |
184 | 184 | if (access_ok(__gu_addr, size)) \ |
185 | 185 | __get_user_size((x), __gu_addr, (size), __gu_err); \ |
186 | 186 | else \ |
187 | - (x) = 0; \ | |
187 | + (x) = (__typeof__(*(ptr)))0; \ | |
188 | 188 | __gu_err; \ |
189 | 189 | }) |
190 | 190 |
@@ -202,13 +202,15 @@ do { \ | ||
202 | 202 | u64 __x; \ |
203 | 203 | if (unlikely(__copy_from_user(&__x, ptr, 8))) { \ |
204 | 204 | retval = -EFAULT; \ |
205 | - (x) = 0; \ | |
205 | + (x) = (__typeof__(*(ptr)))0; \ | |
206 | 206 | } else { \ |
207 | - (x) = *(__force __typeof__((ptr)))&__x; \ | |
207 | + (x) = *(__force __typeof__(*(ptr)) *)&__x; \ | |
208 | 208 | } \ |
209 | 209 | break; \ |
210 | 210 | } \ |
211 | - default: (x) = 0; __get_user_bad(); \ | |
211 | + default: \ | |
212 | + (x) = (__typeof__(*(ptr)))0; \ | |
213 | + __get_user_bad(); \ | |
212 | 214 | } \ |
213 | 215 | } while (0) |
214 | 216 |
@@ -270,15 +272,15 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
270 | 272 | */ |
271 | 273 | |
272 | 274 | static inline unsigned long |
273 | -__xtensa_clear_user(void *addr, unsigned long size) | |
275 | +__xtensa_clear_user(void __user *addr, unsigned long size) | |
274 | 276 | { |
275 | - if (!__memset(addr, 0, size)) | |
277 | + if (!__memset((void __force *)addr, 0, size)) | |
276 | 278 | return size; |
277 | 279 | return 0; |
278 | 280 | } |
279 | 281 | |
280 | 282 | static inline unsigned long |
281 | -clear_user(void *addr, unsigned long size) | |
283 | +clear_user(void __user *addr, unsigned long size) | |
282 | 284 | { |
283 | 285 | if (access_ok(addr, size)) |
284 | 286 | return __xtensa_clear_user(addr, size); |
@@ -290,10 +292,10 @@ clear_user(void *addr, unsigned long size) | ||
290 | 292 | |
291 | 293 | #ifndef CONFIG_GENERIC_STRNCPY_FROM_USER |
292 | 294 | |
293 | -extern long __strncpy_user(char *, const char *, long); | |
295 | +extern long __strncpy_user(char *dst, const char __user *src, long count); | |
294 | 296 | |
295 | 297 | static inline long |
296 | -strncpy_from_user(char *dst, const char *src, long count) | |
298 | +strncpy_from_user(char *dst, const char __user *src, long count) | |
297 | 299 | { |
298 | 300 | if (access_ok(src, 1)) |
299 | 301 | return __strncpy_user(dst, src, count); |
@@ -306,13 +308,11 @@ long strncpy_from_user(char *dst, const char *src, long count); | ||
306 | 308 | /* |
307 | 309 | * Return the size of a string (including the ending 0!) |
308 | 310 | */ |
309 | -extern long __strnlen_user(const char *, long); | |
311 | +extern long __strnlen_user(const char __user *str, long len); | |
310 | 312 | |
311 | -static inline long strnlen_user(const char *str, long len) | |
313 | +static inline long strnlen_user(const char __user *str, long len) | |
312 | 314 | { |
313 | - unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1; | |
314 | - | |
315 | - if ((unsigned long)str > top) | |
315 | + if (!access_ok(str, 1)) | |
316 | 316 | return 0; |
317 | 317 | return __strnlen_user(str, len); |
318 | 318 | } |
@@ -959,14 +959,14 @@ ENDPROC(unrecoverable_exception) | ||
959 | 959 | * of the proper size instead. |
960 | 960 | * |
961 | 961 | * This algorithm simply backs out the register changes started by the user |
962 | - * excpetion handler, makes it appear that we have started a window underflow | |
962 | + * exception handler, makes it appear that we have started a window underflow | |
963 | 963 | * by rotating the window back and then setting the old window base (OWB) in |
964 | 964 | * the 'ps' register with the rolled back window base. The 'movsp' instruction |
965 | 965 | * will be re-executed and this time since the next window frames is in the |
966 | 966 | * active AR registers it won't cause an exception. |
967 | 967 | * |
968 | 968 | * If the WindowUnderflow code gets a TLB miss the page will get mapped |
969 | - * the the partial windeowUnderflow will be handeled in the double exception | |
969 | + * the partial WindowUnderflow will be handled in the double exception | |
970 | 970 | * handler. |
971 | 971 | * |
972 | 972 | * Entry condition: |