Xtensa updates for v5.8:

- fix __user annotations in asm/uaccess.h
 - fix comments in entry.S
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEK2eFS5jlMn3N6xfYUfnMkfg/oEQFAl7XawcTHGpjbXZia2Jj
 QGdtYWlsLmNvbQAKCRBR+cyR+D+gRHnJD/4g36b1hvtF+fLFua6twLlkoW1Iw4Gx
 s7rKD/goY6XgqZYMhfzkNH/2Net8OLVTVn5aAGb1sa07LznMXxT7UyMLKBHbX4Em
 lojApNeMnPGLCija9yHU4rD+vWN4NOb+gxyZYCoQ91A+cqX1Sobm8JSYcnGG81qz
 +lMgGoz0Sr1GEupkSA8PxVHp+DqhZFu4yCKcKvHO26ic61bZbnmwnpm/9Qkrvg0W
 E55yG0I4aAF5OraC0nkSLMieEIf0pZPujrtLAszegRqubzVM1ZSNntc3OPMcvc+s
 iyZdX9ppM3ozmFr7x8BXMUIw5aN4fyxKY9QTHKVRqOzeRYSnqtw9+sRWooLgOliS
 eJe/cXI5Y7rLrHIG7gV/u0x7WkPQOHtW2KvEYG3KkHpm35ZcRdItu1tDaGX6t8pm
 KK2GDyNcY5uqN6agMdNtw8hJm5SBKwvMIdg6kLoJEht0OPe0BbIvSyweBU61dM+q
 CpprzVC/DStOXrZn3g46jkfNhO66JRnulJKlu2LWFAovwsZfTqeb307d750JGwKn
 odOXEXGYBZViMurxYyM/+VBJHeh9yLYlYtT8IiGMTHqYTMgZScDfFsgPvsdQDS3P
 yJeRA7pJwvOIQvG6HZ7FaFmrAhfFy16rk2L7B9MYeB6qcc5z8VgjaWcQXBY3eM8R
 tmbAxwtqwugJpA==
 =NfM2
 -----END PGP SIGNATURE-----

Merge tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa

Pull Xtensa updates from Max Filippov:

 - fix __user annotations in asm/uaccess.h

 - fix comments in entry.S

* tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: Fix spelling/grammar in comment
  xtensa: add missing __user annotations to asm/uaccess.h
  xtensa: fix error paths in __get_user_{check,size}
  xtensa: fix type conversion in __get_user_size
  xtensa: add missing __user annotations to __{get,put}_user_check
This commit is contained in:
Linus Torvalds 2020-06-03 14:01:23 -07:00
commit 38696e33e2
2 changed files with 18 additions and 18 deletions

View File

@ -84,7 +84,7 @@ extern long __put_user_bad(void);
#define __put_user_check(x, ptr, size) \
({ \
long __pu_err = -EFAULT; \
__typeof__(*(ptr)) *__pu_addr = (ptr); \
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
if (access_ok(__pu_addr, size)) \
__put_user_size((x), __pu_addr, (size), __pu_err); \
__pu_err; \
@ -180,11 +180,11 @@ __asm__ __volatile__( \
#define __get_user_check(x, ptr, size) \
({ \
long __gu_err = -EFAULT; \
const __typeof__(*(ptr)) *__gu_addr = (ptr); \
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
if (access_ok(__gu_addr, size)) \
__get_user_size((x), __gu_addr, (size), __gu_err); \
else \
(x) = 0; \
(x) = (__typeof__(*(ptr)))0; \
__gu_err; \
})
@ -202,13 +202,15 @@ do { \
u64 __x; \
if (unlikely(__copy_from_user(&__x, ptr, 8))) { \
retval = -EFAULT; \
(x) = 0; \
(x) = (__typeof__(*(ptr)))0; \
} else { \
(x) = *(__force __typeof__((ptr)))&__x; \
(x) = *(__force __typeof__(*(ptr)) *)&__x; \
} \
break; \
} \
default: (x) = 0; __get_user_bad(); \
default: \
(x) = (__typeof__(*(ptr)))0; \
__get_user_bad(); \
} \
} while (0)
@ -270,15 +272,15 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
*/
static inline unsigned long
__xtensa_clear_user(void *addr, unsigned long size)
__xtensa_clear_user(void __user *addr, unsigned long size)
{
if (!__memset(addr, 0, size))
if (!__memset((void __force *)addr, 0, size))
return size;
return 0;
}
static inline unsigned long
clear_user(void *addr, unsigned long size)
clear_user(void __user *addr, unsigned long size)
{
if (access_ok(addr, size))
return __xtensa_clear_user(addr, size);
@ -290,10 +292,10 @@ clear_user(void *addr, unsigned long size)
#ifndef CONFIG_GENERIC_STRNCPY_FROM_USER
extern long __strncpy_user(char *, const char *, long);
extern long __strncpy_user(char *dst, const char __user *src, long count);
static inline long
strncpy_from_user(char *dst, const char *src, long count)
strncpy_from_user(char *dst, const char __user *src, long count)
{
if (access_ok(src, 1))
return __strncpy_user(dst, src, count);
@ -306,13 +308,11 @@ long strncpy_from_user(char *dst, const char *src, long count);
/*
* Return the size of a string (including the ending 0!)
*/
extern long __strnlen_user(const char *, long);
extern long __strnlen_user(const char __user *str, long len);
static inline long strnlen_user(const char *str, long len)
static inline long strnlen_user(const char __user *str, long len)
{
unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1;
if ((unsigned long)str > top)
if (!access_ok(str, 1))
return 0;
return __strnlen_user(str, len);
}

View File

@ -959,14 +959,14 @@ ENDPROC(unrecoverable_exception)
* of the proper size instead.
*
* This algorithm simply backs out the register changes started by the user
* excpetion handler, makes it appear that we have started a window underflow
* exception handler, makes it appear that we have started a window underflow
* by rotating the window back and then setting the old window base (OWB) in
* the 'ps' register with the rolled back window base. The 'movsp' instruction
* will be re-executed and this time since the next window frames is in the
* active AR registers it won't cause an exception.
*
* If the WindowUnderflow code gets a TLB miss the page will get mapped
* the the partial windeowUnderflow will be handeled in the double exception
* the partial WindowUnderflow will be handled in the double exception
* handler.
*
* Entry condition: