提交 2a7e0775 编写于 作者: L Lars-Peter Clausen 提交者: Bob Liu

Blackfin: Annotate strnlen_user and strlen_user 'src' parameter with __user

The 'src' parameter of strnlen_user and strlen_user is supposed to take a
userspace pointer, so annotate it with __user. This fixes the following and
similar sparse warnings:

	fs/binfmt_elf_fdpic.c:671:36: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:671:36:    expected char const *src
	fs/binfmt_elf_fdpic.c:671:36:    got char [noderef] <asn:1>*[assigned] p
	fs/binfmt_elf_fdpic.c:683:36: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:683:36:    expected char const *src
	fs/binfmt_elf_fdpic.c:683:36:    got char [noderef] <asn:1>*[assigned] p
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NBob Liu <lliubbo@gmail.com>
上级 10dc42b5
...@@ -237,18 +237,18 @@ strncpy_from_user(char *dst, const char __user *src, long count) ...@@ -237,18 +237,18 @@ strncpy_from_user(char *dst, const char __user *src, long count)
* On exception, returns 0. * On exception, returns 0.
* If the string is too long, returns a value greater than n. * If the string is too long, returns a value greater than n.
*/ */
static inline long __must_check strnlen_user(const char *src, long n) static inline long __must_check strnlen_user(const char __user *src, long n)
{ {
if (!access_ok(VERIFY_READ, src, 1)) if (!access_ok(VERIFY_READ, src, 1))
return 0; return 0;
return strnlen(src, n) + 1; return strnlen((const char __force *)src, n) + 1;
} }
static inline long __must_check strlen_user(const char *src) static inline long __must_check strlen_user(const char __user *src)
{ {
if (!access_ok(VERIFY_READ, src, 1)) if (!access_ok(VERIFY_READ, src, 1))
return 0; return 0;
return strlen(src) + 1; return strlen((const char __force *)src) + 1;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册