diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-18 21:16:49 -0400 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:57:58 +0200 |
| commit | 204ecf7c2787420dde7be8d60dfd84c85c43ba1c (patch) | |
| tree | c4d6c2f1d1fd88628a918f087506057812aaf486 /arch/hexagon/include/asm | |
| parent | 2fbb8a412a78a42e8fde2dcd55711f93a664c37f (diff) | |
hexagon: fix strncpy_from_user() error return
commit f35c1e0671728d1c9abc405d05ef548b5fcb2fc4 upstream.
It's -EFAULT, not -1 (and contrary to the comment in there,
__strnlen_user() can return 0 - on faults).
Acked-by: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'arch/hexagon/include/asm')
| -rw-r--r-- | arch/hexagon/include/asm/uaccess.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h index e4127e4d6..25fc9049d 100644 --- a/arch/hexagon/include/asm/uaccess.h +++ b/arch/hexagon/include/asm/uaccess.h @@ -102,7 +102,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); |
