summaryrefslogtreecommitdiffstats
path: root/arch/hexagon/include/asm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-18 21:16:49 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-09-13 17:49:39 -0400
commitf35c1e0671728d1c9abc405d05ef548b5fcb2fc4 (patch)
tree6237bc7d599269b60e8051675eb7c583189555e9 /arch/hexagon/include/asm
parent3b8767a8f00cc6538ba6b1cf0f88502e2fd2eb90 (diff)
downloadlinux-f35c1e0671728d1c9abc405d05ef548b5fcb2fc4.tar.bz2
hexagon: fix strncpy_from_user() error return
It's -EFAULT, not -1 (and contrary to the comment in there, __strnlen_user() can return 0 - on faults). Cc: stable@vger.kernel.org Acked-by: Richard Kuo <rkuo@codeaurora.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/hexagon/include/asm')
-rw-r--r--arch/hexagon/include/asm/uaccess.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index f000a382bc7f..f61cfb28e9f2 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src,
{
long res = __strnlen_user(src, n);
- /* return from strnlen can't be zero -- that would be rubbish. */
+ if (unlikely(!res))
+ return -EFAULT;
if (res > n) {
copy_from_user(dst, src, n);