Commit d95dcaa0 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Bob Liu

Blackfin: Annotate strncpy_from_user src parameter with __user

The src parameter of strncpy_from_user is supposed to take a string from
userspace, so it should be annotated with __user. Doing so fixes the following
and similar warnings from sparse:

	kernel/sys.c:491:51: warning: incorrect type in argument 2 (different address spaces)
	kernel/sys.c:491:51:    expected char const *src
	kernel/sys.c:491:51:    got void [noderef] <asn:1>*arg
	kernel/sys.c:2061:54: warning: incorrect type in argument 2 (different address spaces)
	kernel/sys.c:2061:54:    expected char const *src
	kernel/sys.c:2061:54:    got char [noderef] <asn:1>*<noident>
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
parent e9dfcdbd
...@@ -216,12 +216,12 @@ copy_to_user(void __user *to, const void *from, unsigned long n) ...@@ -216,12 +216,12 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
*/ */
static inline long __must_check static inline long __must_check
strncpy_from_user(char *dst, const char *src, long count) strncpy_from_user(char *dst, const char __user *src, long count)
{ {
char *tmp; char *tmp;
if (!access_ok(VERIFY_READ, src, 1)) if (!access_ok(VERIFY_READ, src, 1))
return -EFAULT; return -EFAULT;
strncpy(dst, src, count); strncpy(dst, (const char __force *)src, count);
for (tmp = dst; *tmp && count > 0; tmp++, count--) ; for (tmp = dst; *tmp && count > 0; tmp++, count--) ;
return (tmp - dst); return (tmp - dst);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment