Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f35c1e06 authored by Al Viro's avatar Al Viro
Browse files

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: default avatarRichard Kuo <rkuo@codeaurora.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3b8767a8
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src,
{
{
	long res = __strnlen_user(src, n);
	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) {
	if (res > n) {
		copy_from_user(dst, src, n);
		copy_from_user(dst, src, n);