microblaze: uaccess: Fix strncpy_from_user function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, April 1, 2010 - 10:59 am

Gitweb:     http://git.kernel.org/linus/40e11e3380d4bd14bb3d85c7e7b863075a6a8d86
Commit:     40e11e3380d4bd14bb3d85c7e7b863075a6a8d86
Parent:     4270690bd4b1420a8d634ea31953a1c4def2a44a
Author:     Michal Simek <monstr@monstr.eu>
AuthorDate: Mon Mar 8 09:38:02 2010 +0100
Committer:  Michal Simek <monstr@monstr.eu>
CommitDate: Thu Apr 1 08:38:21 2010 +0200

    microblaze: uaccess: Fix strncpy_from_user function
    
    Generic implementation for noMMU and MMU version
    
    Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 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 b56d8ae..fe954b3 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,
 }
 
 extern int __strncpy_user(char *to, const char __user *from, int len);
+
+#define __strncpy_from_user	__strncpy_user
+
+static inline long
+strncpy_from_user(char *dst, const char __user *src, long count)
+{
+	if (!access_ok(VERIFY_READ, src, 1))
+		return -EFAULT;
+	return __strncpy_from_user(dst, src, count);
+}
+
 extern int __strnlen_user(const char __user *sstr, int len);
 
-#define strncpy_from_user(to, from, len)	\
-		(access_ok(VERIFY_READ, from, 1) ?	\
-			__strncpy_user(to, from, len) : -EFAULT)
 #define strnlen_user(str, len)	\
 		(access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0)
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
microblaze: uaccess: Fix strncpy_from_user function, Linux Kernel Mailing ..., (Thu Apr 1, 10:59 am)