summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-04-07 17:12:46 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2009-04-21 05:02:50 +0200
commit3eac8778a237d83a1e553eba0c6f4fd4b39eeec0 (patch)
tree0a546e57929310f0968d5e9b43afec08b86aeed5
parentDocumentation/filesystems: remove out of date reference to BKL being held (diff)
downloadlinux-3eac8778a237d83a1e553eba0c6f4fd4b39eeec0.tar.xz
linux-3eac8778a237d83a1e553eba0c6f4fd4b39eeec0.zip
autofs4: use memchr() in invalid_string()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/autofs4/dev-ioctl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 463f798f71b3..84168c0dcc2d 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -54,11 +54,10 @@ static int check_name(const char *name)
* Check a string doesn't overrun the chunk of
* memory we copied from user land.
*/
-static int invalid_str(char *str, void *end)
+static int invalid_str(char *str, size_t size)
{
- while ((void *) str <= end)
- if (!*str++)
- return 0;
+ if (memchr(str, 0, size))
+ return 0;
return -EINVAL;
}
@@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
}
if (param->size > sizeof(*param)) {
- err = invalid_str(param->path,
- (void *) ((size_t) param + param->size));
+ err = invalid_str(param->path, param->size - sizeof(*param));
if (err) {
AUTOFS_WARN(
"path string terminator missing for cmd(0x%08x)",