diff options
author | Michal Simek <monstr@monstr.eu> | 2010-03-08 03:38:02 -0500 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-04-01 02:38:21 -0400 |
commit | 40e11e3380d4bd14bb3d85c7e7b863075a6a8d86 (patch) | |
tree | 00d33e5bb3071a4f93e913d6c527da95888f18a6 /arch/microblaze/include/asm/uaccess.h | |
parent | 4270690bd4b1420a8d634ea31953a1c4def2a44a (diff) |
microblaze: uaccess: Fix strncpy_from_user function
Generic implementation for noMMU and MMU version
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/include/asm/uaccess.h')
-rw-r--r-- | arch/microblaze/include/asm/uaccess.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index b56d8ae9b17e..fe954b394fdc 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -407,11 +407,19 @@ static inline long copy_to_user(void __user *to, | |||
407 | } | 407 | } |
408 | 408 | ||
409 | extern int __strncpy_user(char *to, const char __user *from, int len); | 409 | extern int __strncpy_user(char *to, const char __user *from, int len); |
410 | |||
411 | #define __strncpy_from_user __strncpy_user | ||
412 | |||
413 | static inline long | ||
414 | strncpy_from_user(char *dst, const char __user *src, long count) | ||
415 | { | ||
416 | if (!access_ok(VERIFY_READ, src, 1)) | ||
417 | return -EFAULT; | ||
418 | return __strncpy_from_user(dst, src, count); | ||
419 | } | ||
420 | |||
410 | extern int __strnlen_user(const char __user *sstr, int len); | 421 | extern int __strnlen_user(const char __user *sstr, int len); |
411 | 422 | ||
412 | #define strncpy_from_user(to, from, len) \ | ||
413 | (access_ok(VERIFY_READ, from, 1) ? \ | ||
414 | __strncpy_user(to, from, len) : -EFAULT) | ||
415 | #define strnlen_user(str, len) \ | 423 | #define strnlen_user(str, len) \ |
416 | (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0) | 424 | (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0) |
417 | 425 | ||