summaryrefslogtreecommitdiff
path: root/kernel/bpf/token.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-08-13 14:34:10 -0700
committerAndrii Nakryiko <andrii@kernel.org>2024-08-13 15:58:21 -0700
commiteb80ee85801cd8e3c6f39b08830867d2afecd8f5 (patch)
tree3abca875766b873d4b0a10b97942a9bd21f3c43e /kernel/bpf/token.c
parent55f325958ccc41eaea43eb4546d4dc77c1b5ef8a (diff)
bpf: trivial conversions for fdget()
fdget() is the first thing done in scope, all matching fdput() are immediately followed by leaving the scope. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'kernel/bpf/token.c')
-rw-r--r--kernel/bpf/token.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
index 9a1d356e79ed..9b92cb886d49 100644
--- a/kernel/bpf/token.c
+++ b/kernel/bpf/token.c
@@ -232,19 +232,16 @@ out_path:
struct bpf_token *bpf_token_get_from_fd(u32 ufd)
{
- struct fd f = fdget(ufd);
+ CLASS(fd, f)(ufd);
struct bpf_token *token;
- if (!fd_file(f))
+ if (fd_empty(f))
return ERR_PTR(-EBADF);
- if (fd_file(f)->f_op != &bpf_token_fops) {
- fdput(f);
+ if (fd_file(f)->f_op != &bpf_token_fops)
return ERR_PTR(-EINVAL);
- }
token = fd_file(f)->private_data;
bpf_token_inc(token);
- fdput(f);
return token;
}