diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-10-27 09:08:31 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-02 15:45:30 -0600 |
commit | b54a14041ee6444692d95ff38c8b3d1af682aa17 (patch) | |
tree | 658c5839cb2eb6dd19429c5e4911ea9cd727d664 /io_uring/nop.c | |
parent | 3597f2786b687a7f26361ce00a805ea0af41b65f (diff) |
io_uring/rsrc: add io_rsrc_node_lookup() helper
There are lots of spots open-coding this functionality, add a generic
helper that does the node lookup in a speculation safe way.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/nop.c')
-rw-r--r-- | io_uring/nop.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/io_uring/nop.c b/io_uring/nop.c index 0dac01127de5..149dbdc53607 100644 --- a/io_uring/nop.c +++ b/io_uring/nop.c @@ -62,13 +62,11 @@ int io_nop(struct io_kiocb *req, unsigned int issue_flags) if (nop->flags & IORING_NOP_FIXED_BUFFER) { struct io_ring_ctx *ctx = req->ctx; struct io_rsrc_node *node; - int idx; ret = -EFAULT; io_ring_submit_lock(ctx, issue_flags); - if (nop->buffer < ctx->buf_table.nr) { - idx = array_index_nospec(nop->buffer, ctx->buf_table.nr); - node = READ_ONCE(ctx->buf_table.nodes[idx]); + node = io_rsrc_node_lookup(&ctx->buf_table, nop->buffer); + if (node) { io_req_assign_rsrc_node(req, node); ret = 0; } |