Skip to content

Commit 0dd4fb7

Browse files
author
Al Viro
committed
fs/stat.c: switch to CLASS(fd_raw)
... and use fd_empty() consistently Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 88a2062 commit 0dd4fb7

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

fs/stat.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,10 @@ EXPORT_SYMBOL(vfs_getattr);
220220
*/
221221
int vfs_fstat(int fd, struct kstat *stat)
222222
{
223-
struct fd f;
224-
int error;
225-
226-
f = fdget_raw(fd);
227-
if (!fd_file(f))
223+
CLASS(fd_raw, f)(fd);
224+
if (fd_empty(f))
228225
return -EBADF;
229-
error = vfs_getattr(&fd_file(f)->f_path, stat, STATX_BASIC_STATS, 0);
230-
fdput(f);
231-
return error;
226+
return vfs_getattr(&fd_file(f)->f_path, stat, STATX_BASIC_STATS, 0);
232227
}
233228

234229
static int statx_lookup_flags(int flags)
@@ -275,7 +270,7 @@ static int vfs_statx_fd(int fd, int flags, struct kstat *stat,
275270
u32 request_mask)
276271
{
277272
CLASS(fd_raw, f)(fd);
278-
if (!fd_file(f))
273+
if (fd_empty(f))
279274
return -EBADF;
280275
return vfs_statx_path(&fd_file(f)->f_path, flags, stat, request_mask);
281276
}

0 commit comments

Comments
 (0)