summaryrefslogtreecommitdiff
path: root/fs/stat.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-04-30 14:57:58 +0300
committerChristian Brauner <brauner@kernel.org>2024-06-27 19:31:20 +0300
commit27a2d0cb2f38c67b58285e6124b14f7fff3fd1a8 (patch)
tree041e615eb7d4de1af506466aad128dba4c544f25 /fs/stat.c
parent1bc6d4452d5c91beb09e37a98a590808e1997b79 (diff)
downloadlinux-27a2d0cb2f38c67b58285e6124b14f7fff3fd1a8.tar.xz
stat: use vfs_empty_path() helper
Use the newly added helper for this. Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/fs/stat.c b/fs/stat.c
index 16aa1f5ceec4..5039c34a385d 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -289,16 +289,8 @@ int vfs_fstatat(int dfd, const char __user *filename,
* If AT_EMPTY_PATH is set, we expect the common case to be that
* empty path, and avoid doing all the extra pathname work.
*/
- if (dfd >= 0 && flags == AT_EMPTY_PATH) {
- char c;
-
- ret = get_user(c, filename);
- if (unlikely(ret))
- return ret;
-
- if (likely(!c))
- return vfs_fstat(dfd, stat);
- }
+ if (flags == AT_EMPTY_PATH && vfs_empty_path(dfd, filename))
+ return vfs_fstat(dfd, stat);
name = getname_flags(filename, getname_statx_lookup_flags(statx_flags));
ret = vfs_statx(dfd, name, statx_flags, stat, STATX_BASIC_STATS);