Commit 4be1c615 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: kill extra user_bufs check

Testing ctx->user_bufs for NULL in io_import_fixed() is not neccessary,
because in that case ctx->nr_user_bufs would be zero, and the following
check would fail.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ab0b196c
...@@ -2672,18 +2672,12 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw, ...@@ -2672,18 +2672,12 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw,
struct io_ring_ctx *ctx = req->ctx; struct io_ring_ctx *ctx = req->ctx;
size_t len = req->rw.len; size_t len = req->rw.len;
struct io_mapped_ubuf *imu; struct io_mapped_ubuf *imu;
u16 index, buf_index; u16 index, buf_index = req->buf_index;
size_t offset; size_t offset;
u64 buf_addr; u64 buf_addr;
/* attempt to use fixed buffers without having provided iovecs */
if (unlikely(!ctx->user_bufs))
return -EFAULT;
buf_index = req->buf_index;
if (unlikely(buf_index >= ctx->nr_user_bufs)) if (unlikely(buf_index >= ctx->nr_user_bufs))
return -EFAULT; return -EFAULT;
index = array_index_nospec(buf_index, ctx->nr_user_bufs); index = array_index_nospec(buf_index, ctx->nr_user_bufs);
imu = &ctx->user_bufs[index]; imu = &ctx->user_bufs[index];
buf_addr = req->rw.addr; buf_addr = req->rw.addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment