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=6e050503a150b2126620c1a1e9b3a368fcd51eac;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git sh: fix copy_from_user() Cc: stable@vger.kernel.org Signed-off-by: Al Viro --- diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index a49635c51266..92ade79ac427 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; }