Skip to content

Commit 27a2d0c

Browse files
committed
stat: use vfs_empty_path() helper
Use the newly added helper for this. Signed-off-by: Christian Brauner <[email protected]>
1 parent 1bc6d44 commit 27a2d0c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

fs/stat.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,8 @@ int vfs_fstatat(int dfd, const char __user *filename,
289289
* If AT_EMPTY_PATH is set, we expect the common case to be that
290290
* empty path, and avoid doing all the extra pathname work.
291291
*/
292-
if (dfd >= 0 && flags == AT_EMPTY_PATH) {
293-
char c;
294-
295-
ret = get_user(c, filename);
296-
if (unlikely(ret))
297-
return ret;
298-
299-
if (likely(!c))
300-
return vfs_fstat(dfd, stat);
301-
}
292+
if (flags == AT_EMPTY_PATH && vfs_empty_path(dfd, filename))
293+
return vfs_fstat(dfd, stat);
302294

303295
name = getname_flags(filename, getname_statx_lookup_flags(statx_flags));
304296
ret = vfs_statx(dfd, name, statx_flags, stat, STATX_BASIC_STATS);

0 commit comments

Comments
 (0)