diff options
author | Christoph Hellwig <hch@lst.de> | 2023-06-20 13:32:33 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-20 09:36:22 -0600 |
commit | 60a666f097a8d722a3907925d21e363add289c8c (patch) | |
tree | 71f156959d34119fb3d2894866185ccd493d6445 /io_uring/cancel.c | |
parent | 8487f083c6ff6e02b2ec14f22ef2b0079a1b6425 (diff) | |
download | linux-stable-60a666f097a8d722a3907925d21e363add289c8c.tar.gz linux-stable-60a666f097a8d722a3907925d21e363add289c8c.tar.bz2 linux-stable-60a666f097a8d722a3907925d21e363add289c8c.zip |
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>
Diffstat (limited to 'io_uring/cancel.c')
-rw-r--r-- | io_uring/cancel.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/io_uring/cancel.c b/io_uring/cancel.c index b4f5dfacc0c3..58c46c852bdd 100644 --- a/io_uring/cancel.c +++ b/io_uring/cancel.c @@ -216,13 +216,10 @@ static int __io_sync_cancel(struct io_uring_task *tctx, /* fixed must be grabbed every time since we drop the uring_lock */ if ((cd->flags & IORING_ASYNC_CANCEL_FD) && (cd->flags & IORING_ASYNC_CANCEL_FD_FIXED)) { - unsigned long file_ptr; - if (unlikely(fd >= ctx->nr_user_files)) return -EBADF; fd = array_index_nospec(fd, ctx->nr_user_files); - file_ptr = io_fixed_file_slot(&ctx->file_table, fd)->file_ptr; - cd->file = (struct file *) (file_ptr & FFS_MASK); + cd->file = io_file_from_index(&ctx->file_table, fd); if (!cd->file) return -EBADF; } |