Skip to contentSkip to conversation

exec: add __user case in get_user_arg_ptr()

PATCH New Ben Dooks 1 participant 1 message Mar 1, 2019

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 exec: add __user case in get_user_arg_ptr()

The get_user_arg_ptr() returns a __user annotated pointer but the ERR_PTR() returns do not have this annotation which triggers sparse warnings. Add a case to (char __user *) to fix the following:

fs/exec.c:409:39: warning: incorrect type in return expression (different address spaces)
fs/exec.c:409:39: expected char const [noderef] <asn:1>*
fs/exec.c:409:39: got void *
fs/exec.c:416:31: warning: incorrect type in return expression (different address spaces)
fs/exec.c:416:31: expected char const [noderef] <asn:1>*
fs/exec.c:416:31: got void *

---
 fs/exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/exec.c +2 -2
index fb72d36f7823..19fa6f082db9 100644
@@ -406,14 +406,14 @@ static const char __user *get_user_arg_ptr(struct user_arg_ptr argv, int nr)
 		compat_uptr_t compat;
 
 		if (get_user(compat, argv.ptr.compat + nr))
-			return ERR_PTR(-EFAULT);
+			return (char __user *)ERR_PTR(-EFAULT);
 
 		return compat_ptr(compat);
 	}
 #endif
 
 	if (get_user(native, argv.ptr.native + nr))
-		return ERR_PTR(-EFAULT);
+		return (char __user *)ERR_PTR(-EFAULT);
 
 	return native;
 }
Signature · 1 line
2.20.1