summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-20 14:32:34 +0300
committerJens Axboe <axboe@kernel.dk>2023-06-20 18:36:22 +0300
commitf432c8c8c12b84c5465b1ffddb6feb7d6b19c1ca (patch)
tree3cd9455604f1083b36fca3e8806f9e7ea105cc65
parent60a666f097a8d722a3907925d21e363add289c8c (diff)
downloadlinux-f432c8c8c12b84c5465b1ffddb6feb7d6b19c1ca.tar.xz
io_uring: use io_file_from_index in io_msg_grab_file
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-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/msg_ring.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c
index 85fd7ce5f05b..cd6dcf634ba3 100644
--- a/io_uring/msg_ring.c
+++ b/io_uring/msg_ring.c
@@ -162,14 +162,12 @@ static struct file *io_msg_grab_file(struct io_kiocb *req, unsigned int issue_fl
struct io_msg *msg = io_kiocb_to_cmd(req, struct io_msg);
struct io_ring_ctx *ctx = req->ctx;
struct file *file = NULL;
- unsigned long file_ptr;
int idx = msg->src_fd;
io_ring_submit_lock(ctx, issue_flags);
if (likely(idx < ctx->nr_user_files)) {
idx = array_index_nospec(idx, ctx->nr_user_files);
- file_ptr = io_fixed_file_slot(&ctx->file_table, idx)->file_ptr;
- file = (struct file *) (file_ptr & FFS_MASK);
+ file = io_file_from_index(&ctx->file_table, idx);
if (file)
get_file(file);
}