mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 15:19:51 +00:00
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>
This commit is contained in:
parent
233295130e
commit
479f517be5
@ -5987,8 +5987,7 @@ static int io_file_get(struct io_submit_state *state, struct io_kiocb *req,
|
|||||||
struct file *file;
|
struct file *file;
|
||||||
|
|
||||||
if (fixed) {
|
if (fixed) {
|
||||||
if (unlikely(!ctx->file_data ||
|
if (unlikely((unsigned int)fd >= ctx->nr_user_files))
|
||||||
(unsigned) fd >= ctx->nr_user_files))
|
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
fd = array_index_nospec(fd, ctx->nr_user_files);
|
fd = array_index_nospec(fd, ctx->nr_user_files);
|
||||||
file = io_file_from_index(ctx, fd);
|
file = io_file_from_index(ctx, fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user