diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-10-17 10:28:02 -0400 |
---|---|---|
committer | Bob Liu <lliubbo@gmail.com> | 2012-12-13 00:50:56 -0500 |
commit | d95dcaa06ba895ec379d80b35c25ddba3a71943a (patch) | |
tree | 82e135400f20a33709b90b100c86c82167a3cf19 /arch/blackfin | |
parent | e9dfcdbd76b14a24e751d6e0bfb29dc262c69b0c (diff) |
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/include/asm/uaccess.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 5cc111502822..3edb4afa3053 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h | |||
@@ -216,12 +216,12 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
216 | */ | 216 | */ |
217 | 217 | ||
218 | static inline long __must_check | 218 | static inline long __must_check |
219 | strncpy_from_user(char *dst, const char *src, long count) | 219 | strncpy_from_user(char *dst, const char __user *src, long count) |
220 | { | 220 | { |
221 | char *tmp; | 221 | char *tmp; |
222 | if (!access_ok(VERIFY_READ, src, 1)) | 222 | if (!access_ok(VERIFY_READ, src, 1)) |
223 | return -EFAULT; | 223 | return -EFAULT; |
224 | strncpy(dst, src, count); | 224 | strncpy(dst, (const char __force *)src, count); |
225 | for (tmp = dst; *tmp && count > 0; tmp++, count--) ; | 225 | for (tmp = dst; *tmp && count > 0; tmp++, count--) ; |
226 | return (tmp - dst); | 226 | return (tmp - dst); |
227 | } | 227 | } |