summaryrefslogtreecommitdiffstats
path: root/kernel/arch/avr32
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/arch/avr32')
-rw-r--r--kernel/arch/avr32/include/asm/uaccess.h11
-rw-r--r--kernel/arch/avr32/kernel/avr32_ksyms.c2
-rw-r--r--kernel/arch/avr32/lib/copy_user.S8
-rw-r--r--kernel/arch/avr32/mach-at32ap/pio.c2
4 files changed, 16 insertions, 7 deletions
diff --git a/kernel/arch/avr32/include/asm/uaccess.h b/kernel/arch/avr32/include/asm/uaccess.h
index 68cf638fa..b1ec1fa06 100644
--- a/kernel/arch/avr32/include/asm/uaccess.h
+++ b/kernel/arch/avr32/include/asm/uaccess.h
@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from,
extern __kernel_size_t copy_to_user(void __user *to, const void *from,
__kernel_size_t n);
-extern __kernel_size_t copy_from_user(void *to, const void __user *from,
+extern __kernel_size_t ___copy_from_user(void *to, const void __user *from,
__kernel_size_t n);
static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to,
{
return __copy_user(to, (const void __force *)from, n);
}
+static inline __kernel_size_t copy_from_user(void *to,
+ const void __user *from,
+ __kernel_size_t n)
+{
+ size_t res = ___copy_from_user(to, from, n);
+ if (unlikely(res))
+ memset(to + (n - res), 0, res);
+ return res;
+}
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
diff --git a/kernel/arch/avr32/kernel/avr32_ksyms.c b/kernel/arch/avr32/kernel/avr32_ksyms.c
index d93ead02d..7c6cf14f0 100644
--- a/kernel/arch/avr32/kernel/avr32_ksyms.c
+++ b/kernel/arch/avr32/kernel/avr32_ksyms.c
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page);
/*
* Userspace access stuff.
*/
-EXPORT_SYMBOL(copy_from_user);
+EXPORT_SYMBOL(___copy_from_user);
EXPORT_SYMBOL(copy_to_user);
EXPORT_SYMBOL(__copy_user);
EXPORT_SYMBOL(strncpy_from_user);
diff --git a/kernel/arch/avr32/lib/copy_user.S b/kernel/arch/avr32/lib/copy_user.S
index ea59c04b0..075373471 100644
--- a/kernel/arch/avr32/lib/copy_user.S
+++ b/kernel/arch/avr32/lib/copy_user.S
@@ -23,13 +23,13 @@
*/
.text
.align 1
- .global copy_from_user
- .type copy_from_user, @function
-copy_from_user:
+ .global ___copy_from_user
+ .type ___copy_from_user, @function
+___copy_from_user:
branch_if_kernel r8, __copy_user
ret_if_privileged r8, r11, r10, r10
rjmp __copy_user
- .size copy_from_user, . - copy_from_user
+ .size ___copy_from_user, . - ___copy_from_user
.global copy_to_user
.type copy_to_user, @function
diff --git a/kernel/arch/avr32/mach-at32ap/pio.c b/kernel/arch/avr32/mach-at32ap/pio.c
index 4f61378c3..456128174 100644
--- a/kernel/arch/avr32/mach-at32ap/pio.c
+++ b/kernel/arch/avr32/mach-at32ap/pio.c
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
struct resource *regs;
struct pio_device *pio;
- if (pdev->id > MAX_NR_PIO_DEVICES) {
+ if (pdev->id >= MAX_NR_PIO_DEVICES) {
dev_err(&pdev->dev, "only %d PIO devices supported\n",
MAX_NR_PIO_DEVICES);
return;