aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-10-10 18:34:07 +0100
committerJens Axboe <axboe@kernel.dk>2020-10-10 12:49:24 -0600
commit479f517be57185087c2ae3c5e5aea0c3c6d4e5cc (patch)
treeaf7e00cee7da8127c00ba5405853ce1f06543157 /fs
parent233295130e53c8dfe6dbef3f52634c3f7e44cd6a (diff)
downloadlinux-stericsson-479f517be57185087c2ae3c5e5aea0c3c6d4e5cc.tar.gz
io_uring: kill extra check in fixed io_file_get()
ctx->nr_user_files == 0 IFF ctx->file_data == NULL and there fixed files are not used. Hence, verifying fds only against ctx->nr_user_files is enough. Remove the other check from hot path. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3a65bcba5a7b..39c37cef9ce0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5987,8 +5987,7 @@ static int io_file_get(struct io_submit_state *state, struct io_kiocb *req,
struct file *file;
if (fixed) {
- if (unlikely(!ctx->file_data ||
- (unsigned) fd >= ctx->nr_user_files))
+ if (unlikely((unsigned int)fd >= ctx->nr_user_files))
return -EBADF;
fd = array_index_nospec(fd, ctx->nr_user_files);
file = io_file_from_index(ctx, fd);