summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/include
diff options
context:
space:
mode:
authorMax Filippov2017-12-17 23:43:15 +0100
committerMax Filippov2017-12-18 00:34:57 +0100
commit57358ba9564a0520f870dc14a0f91e7dacc18236 (patch)
tree616be15e6bbe43bbf7539a359b3485b070f62920 /arch/xtensa/include
parentxtensa: use __memset in __xtensa_clear_user (diff)
downloadkernel-qcow2-linux-57358ba9564a0520f870dc14a0f91e7dacc18236.tar.gz
kernel-qcow2-linux-57358ba9564a0520f870dc14a0f91e7dacc18236.tar.xz
kernel-qcow2-linux-57358ba9564a0520f870dc14a0f91e7dacc18236.zip
xtensa: use generic strncpy_from_user with KASAN
This enables KASAN check of the destination buffer. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/include')
-rw-r--r--arch/xtensa/include/asm/uaccess.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h
index 18bbe1caad94..f1158b4c629c 100644
--- a/arch/xtensa/include/asm/uaccess.h
+++ b/arch/xtensa/include/asm/uaccess.h
@@ -44,6 +44,8 @@
#define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size)))
#define access_ok(type, addr, size) __access_ok((unsigned long)(addr), (size))
+#define user_addr_max() (uaccess_kernel() ? ~0UL : TASK_SIZE)
+
/*
* These are the main single-value transfer routines. They
* automatically use the right size if we just have the right pointer
@@ -277,6 +279,8 @@ clear_user(void *addr, unsigned long size)
#define __clear_user __xtensa_clear_user
+#ifndef CONFIG_GENERIC_STRNCPY_FROM_USER
+
extern long __strncpy_user(char *, const char *, long);
static inline long
@@ -286,6 +290,9 @@ strncpy_from_user(char *dst, const char *src, long count)
return __strncpy_user(dst, src, count);
return -EFAULT;
}
+#else
+long strncpy_from_user(char *dst, const char *src, long count);
+#endif
/*
* Return the size of a string (including the ending 0!)