Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

do_sys_truncate(): import pathname only once

Convert the user_path_at() call inside a retry loop into getname_flags() +
filename_lookup() + putname() and leave only filename_lookup() inside
the loop.

In this case we never pass LOOKUP_EMPTY, so getname_flags() is equivalent
to plain getname().

The things could be further simplified by use of cleanup.h stuff, but
let's not clutter the patch with that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro cf6b819c 85a4fe3c

+4 -1
+4 -1
fs/open.c
··· 129 129 int do_sys_truncate(const char __user *pathname, loff_t length) 130 130 { 131 131 unsigned int lookup_flags = LOOKUP_FOLLOW; 132 + struct filename *name; 132 133 struct path path; 133 134 int error; 134 135 135 136 if (length < 0) /* sorry, but loff_t says... */ 136 137 return -EINVAL; 137 138 139 + name = getname(pathname); 138 140 retry: 139 - error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); 141 + error = filename_lookup(AT_FDCWD, name, lookup_flags, &path, NULL); 140 142 if (!error) { 141 143 error = vfs_truncate(&path, length); 142 144 path_put(&path); ··· 147 145 lookup_flags |= LOOKUP_REVAL; 148 146 goto retry; 149 147 } 148 + putname(name); 150 149 return error; 151 150 } 152 151