diff options
author | Arnd Bergmann <arnd@arndb.de> | 2020-01-16 15:58:41 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2021-07-27 23:01:13 +0200 |
commit | b26b181651f3214fa2383411fb85029b7f3e1788 (patch) | |
tree | 06163a94c86fc93e2c7ef7c70caeb651b8da2859 /arch/microblaze/include | |
parent | 0cd1151886933d4845db02b3d09ad4df62d44c50 (diff) | |
download | linux-stable-b26b181651f3214fa2383411fb85029b7f3e1788.tar.gz linux-stable-b26b181651f3214fa2383411fb85029b7f3e1788.tar.bz2 linux-stable-b26b181651f3214fa2383411fb85029b7f3e1788.zip |
microblaze: use generic strncpy/strnlen from_user
Remove the microblaze implemenation of strncpy/strnlen and instead use
the generic versions. The microblaze version is fairly slow because it
always does byte accesses even for aligned data, and it lacks a checks
for user_addr_max().
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/microblaze/include')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index c44b59470e45..d2a8ef9f8978 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h @@ -35,6 +35,7 @@ # define get_fs() (current_thread_info()->addr_limit) # define set_fs(val) (current_thread_info()->addr_limit = (val)) +# define user_addr_max() get_fs().seg # define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg) @@ -296,28 +297,14 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) /* * Copy a null terminated string from userspace. */ -extern int __strncpy_user(char *to, const char __user *from, int len); - -static inline long -strncpy_from_user(char *dst, const char __user *src, long count) -{ - if (!access_ok(src, 1)) - return -EFAULT; - return __strncpy_user(dst, src, count); -} +__must_check long strncpy_from_user(char *dst, const char __user *src, + long count); /* * Return the size of a string (including the ending 0) * * Return 0 on exception, a value greater than N if too long */ -extern int __strnlen_user(const char __user *sstr, int len); - -static inline long strnlen_user(const char __user *src, long n) -{ - if (!access_ok(src, 1)) - return 0; - return __strnlen_user(src, n); -} +__must_check long strnlen_user(const char __user *sstr, long len); #endif /* _ASM_MICROBLAZE_UACCESS_H */ |