diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-21 23:39:47 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-11-20 01:01:40 +0000 |
commit | 6089b5ee9c5f2de2bae342da15afe8d4124b9ebe (patch) | |
tree | 6823dab00f3547dc68165ca98e7a82416731af65 /arch | |
parent | 264a03512d38ad22ba58ba06817f46506246309e (diff) | |
download | linux-stable-6089b5ee9c5f2de2bae342da15afe8d4124b9ebe.tar.gz linux-stable-6089b5ee9c5f2de2bae342da15afe8d4124b9ebe.tar.bz2 linux-stable-6089b5ee9c5f2de2bae342da15afe8d4124b9ebe.zip |
sh: fix copy_from_user()
commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/include/asm/uaccess.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 075848f43b6a..0e7971185be5 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -175,7 +175,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) __kernel_size_t __copy_size = (__kernel_size_t) n; if (__copy_size && __access_ok(__copy_from, __copy_size)) - return __copy_user(to, from, __copy_size); + __copy_size = __copy_user(to, from, __copy_size); + + if (unlikely(__copy_size)) + memset(to + (n - __copy_size), 0, __copy_size); return __copy_size; } |