diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-14 13:32:23 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-14 13:32:30 +0400 |
commit | 05cfbd66d07c44865983c8b65ae9d0037d874206 (patch) | |
tree | 084b665cc97b47d1592fe76ea0a39a7753288a02 /arch/microblaze/lib/uaccess.c | |
parent | 31c9a24ec82926fcae49483e53566d231e705057 (diff) | |
parent | ef631b0ca01655d24e9ca7e199262c4a46416a26 (diff) | |
download | linux-05cfbd66d07c44865983c8b65ae9d0037d874206.tar.xz |
Merge branch 'core/urgent' into core/rcu
Merge reason: new patches to be queued up depend on:
ef631b0: rcu: Make hierarchical RCU less IPI-happy
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/microblaze/lib/uaccess.c')
-rw-r--r-- | arch/microblaze/lib/uaccess.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c new file mode 100644 index 000000000000..8eb9df5a26c9 --- /dev/null +++ b/arch/microblaze/lib/uaccess.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Atmark Techno, Inc. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include <linux/string.h> +#include <asm/uaccess.h> + +#include <asm/bug.h> + +long strnlen_user(const char __user *src, long count) +{ + return strlen(src) + 1; +} + +#define __do_strncpy_from_user(dst, src, count, res) \ + do { \ + char *tmp; \ + strncpy(dst, src, count); \ + for (tmp = dst; *tmp && count > 0; tmp++, count--) \ + ; \ + res = (tmp - dst); \ + } while (0) + +long __strncpy_from_user(char *dst, const char __user *src, long count) +{ + long res; + __do_strncpy_from_user(dst, src, count, res); + return res; +} + +long strncpy_from_user(char *dst, const char __user *src, long count) +{ + long res = -EFAULT; + if (access_ok(VERIFY_READ, src, 1)) + __do_strncpy_from_user(dst, src, count, res); + return res; +} |