From: Al Viro Date: Mon, 22 Aug 2016 03:39:47 +0000 (-0400) Subject: sh: fix copy_from_user() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a6c16ec5a29417fcef420d1d014cc7e82345b371;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git sh: fix copy_from_user() commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream. Signed-off-by: Al Viro Signed-off-by: Willy Tarreau --- diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 9486376605f4..c04cc18ae9cd 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h @@ -151,7 +151,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; }