Pass a buf explicitly into io_import_fixed(), so it can be used not only for rw requests. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 88daf5fc7e8e..7703291617f3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2933,21 +2933,18 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, io_rw_done(kiocb, ret); } -static ssize_t io_import_fixed(struct io_kiocb *req, int rw, - struct iov_iter *iter) +static ssize_t io_import_fixed(struct io_kiocb *req, int rw, u64 buf_addr, + size_t len, struct iov_iter *iter) { struct io_ring_ctx *ctx = req->ctx; - size_t len = req->rw.len; struct io_mapped_ubuf *imu; u16 index, buf_index = req->buf_index; size_t offset; - u64 buf_addr; if (unlikely(buf_index >= ctx->nr_user_bufs)) return -EFAULT; index = array_index_nospec(buf_index, ctx->nr_user_bufs); imu = &ctx->user_bufs[index]; - buf_addr = req->rw.addr; /* overflow */ if (buf_addr + len < buf_addr) @@ -3153,7 +3150,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, opcode = req->opcode; if (opcode == IORING_OP_READ_FIXED || opcode == IORING_OP_WRITE_FIXED) { *iovec = NULL; - return io_import_fixed(req, rw, iter); + return io_import_fixed(req, rw, req->rw.addr, sqe_len, iter); } /* buffer index only valid with fixed read/write, or buffer select */ -- 2.24.0