From 83842ac1d65a3d1a35e91ad891929ac6f831db8f Mon Sep 17 00:00:00 2001 From: Imran Khan Date: Thu, 31 Mar 2016 18:01:06 +0530 Subject: [PATCH] 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 --- lib/strncpy_from_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index 9d2683b521ae..2e03567e1e6b 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -44,7 +44,7 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, long ret = __get_user(c, src + res); if (ret) - return -ret; + return -EFAULT; dst[res] = c; if (!c) return res;