lib: do_strncpy_from_user: Fix return error code for get_user failures
If byte wise copy fails here, we should return EFAULT. Returning a value other than that would cause failure of some of the user-space test cases. CRs-Fixed: 989314 Change-Id: I38ce12d44f25dc89bdd29e8abacd8777f0a8b9a1 Signed-off-by: Imran Khan <kimran@codeaurora.org>
This commit is contained in:
parent
5daf1be1ad
commit
83842ac1d6
1 changed files with 1 additions and 1 deletions
|
@ -44,7 +44,7 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, long
|
||||||
|
|
||||||
ret = __get_user(c, src + res);
|
ret = __get_user(c, src + res);
|
||||||
if (ret)
|
if (ret)
|
||||||
return -ret;
|
return -EFAULT;
|
||||||
dst[res] = c;
|
dst[res] = c;
|
||||||
if (!c)
|
if (!c)
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Reference in a new issue