Loading fs/autofs4/dev-ioctl.c +4 −6 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,9 @@ static int check_name(const char *name) * Check a string doesn't overrun the chunk of * Check a string doesn't overrun the chunk of * memory we copied from user land. * 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 (memchr(str, 0, size)) if (!*str++) return 0; return 0; return -EINVAL; return -EINVAL; } } Loading Loading @@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param) } } if (param->size > sizeof(*param)) { if (param->size > sizeof(*param)) { err = invalid_str(param->path, err = invalid_str(param->path, param->size - sizeof(*param)); (void *) ((size_t) param + param->size)); if (err) { if (err) { AUTOFS_WARN( AUTOFS_WARN( "path string terminator missing for cmd(0x%08x)", "path string terminator missing for cmd(0x%08x)", Loading Loading
fs/autofs4/dev-ioctl.c +4 −6 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,9 @@ static int check_name(const char *name) * Check a string doesn't overrun the chunk of * Check a string doesn't overrun the chunk of * memory we copied from user land. * 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 (memchr(str, 0, size)) if (!*str++) return 0; return 0; return -EINVAL; return -EINVAL; } } Loading Loading @@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param) } } if (param->size > sizeof(*param)) { if (param->size > sizeof(*param)) { err = invalid_str(param->path, err = invalid_str(param->path, param->size - sizeof(*param)); (void *) ((size_t) param + param->size)); if (err) { if (err) { AUTOFS_WARN( AUTOFS_WARN( "path string terminator missing for cmd(0x%08x)", "path string terminator missing for cmd(0x%08x)", Loading