Skip to content

Commit

Permalink
fs/stat.c: switch to CLASS(fd_raw)
Browse files Browse the repository at this point in the history
... and use fd_empty() consistently

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Nov 13, 2024
1 parent 88a2062 commit 0dd4fb7
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,10 @@ EXPORT_SYMBOL(vfs_getattr);
*/
int vfs_fstat(int fd, struct kstat *stat)
{
struct fd f;
int error;

f = fdget_raw(fd);
if (!fd_file(f))
CLASS(fd_raw, f)(fd);
if (fd_empty(f))
return -EBADF;
error = vfs_getattr(&fd_file(f)->f_path, stat, STATX_BASIC_STATS, 0);
fdput(f);
return error;
return vfs_getattr(&fd_file(f)->f_path, stat, STATX_BASIC_STATS, 0);
}

static int statx_lookup_flags(int flags)
Expand Down Expand Up @@ -275,7 +270,7 @@ static int vfs_statx_fd(int fd, int flags, struct kstat *stat,
u32 request_mask)
{
CLASS(fd_raw, f)(fd);
if (!fd_file(f))
if (fd_empty(f))
return -EBADF;
return vfs_statx_path(&fd_file(f)->f_path, flags, stat, request_mask);
}
Expand Down

0 comments on commit 0dd4fb7

Please sign in to comment.