From: Pavel Begunkov Date: Sat, 5 Sep 2020 21:45:48 +0000 (+0300) Subject: io_uring: kill extra user_bufs check X-Git-Tag: baikal/mips/sdk5.9~12522^2~35 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=0298165ed5048ac7839e8d1ded8be7bf5379c4d8;p=kernel.git 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: Pavel Begunkov Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index ed7032bb76bf7..f3d90a6108f82 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2672,18 +2672,12 @@ static ssize_t io_import_fixed(struct io_kiocb *req, int rw, struct io_ring_ctx *ctx = req->ctx; size_t len = req->rw.len; struct io_mapped_ubuf *imu; - u16 index, buf_index; + u16 index, buf_index = req->buf_index; size_t offset; 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)) return -EFAULT; - index = array_index_nospec(buf_index, ctx->nr_user_bufs); imu = &ctx->user_bufs[index]; buf_addr = req->rw.addr;