Skip to content

Commit 60a666f

Browse files
Christoph Hellwigaxboe
authored andcommitted
io_uring: use io_file_from_index in __io_sync_cancel
Use io_file_from_index instead of open coding it. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20230620113235.920399-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8487f08 commit 60a666f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

io_uring/cancel.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,10 @@ static int __io_sync_cancel(struct io_uring_task *tctx,
216216
/* fixed must be grabbed every time since we drop the uring_lock */
217217
if ((cd->flags & IORING_ASYNC_CANCEL_FD) &&
218218
(cd->flags & IORING_ASYNC_CANCEL_FD_FIXED)) {
219-
unsigned long file_ptr;
220-
221219
if (unlikely(fd >= ctx->nr_user_files))
222220
return -EBADF;
223221
fd = array_index_nospec(fd, ctx->nr_user_files);
224-
file_ptr = io_fixed_file_slot(&ctx->file_table, fd)->file_ptr;
225-
cd->file = (struct file *) (file_ptr & FFS_MASK);
222+
cd->file = io_file_from_index(&ctx->file_table, fd);
226223
if (!cd->file)
227224
return -EBADF;
228225
}

0 commit comments

Comments
 (0)