diff options
author | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-01-15 18:08:09 +0800 |
---|---|---|
committer | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-03-17 09:19:05 +0800 |
commit | 7f509a9ef7af0d6ac852d49eb87ed2b9857821cc (patch) | |
tree | b6e1eb8c435cf14ce5626a33ab2da36aee9f791c /include/asm-generic/uaccess.h | |
parent | 38f5bf84bd588a82890f5ab32cba3317555a73e1 (diff) | |
download | linux-7f509a9ef7af0d6ac852d49eb87ed2b9857821cc.tar.bz2 |
asm-generic headers: add arch-specific __strnlen_user calling in uaccess.h
This patch changes the implementation of strnlen_user in include/asm-generic/uaccess.h.
Originally, it calls strlen() function directly, which may not correctly handle the access of
user space in most mmu-enabled architectures.
New __strnlen_user is added for using as an architecture specific function.
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/asm-generic/uaccess.h')
-rw-r--r-- | include/asm-generic/uaccess.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index b218b8513d04..ac68c999b6c2 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -288,14 +288,16 @@ strncpy_from_user(char *dst, const char __user *src, long count) * * Return 0 on exception, a value greater than N if too long */ -#ifndef strnlen_user +#ifndef __strnlen_user +#define __strnlen_user strnlen +#endif + static inline long strnlen_user(const char __user *src, long n) { if (!access_ok(VERIFY_READ, src, 1)) return 0; - return strlen((void * __force)src) + 1; + return __strnlen_user(src, n); } -#endif static inline long strlen_user(const char __user *src) { |