summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-09-05 23:45:48 +0200
committerJens Axboe <axboe@kernel.dk>2020-10-01 04:32:34 +0200
commit4be1c615126963ade321492283c05fb653f55099 (patch)
tree04b140e37dde26645d226f9b461ad286b42475e1 /fs
parentio_uring: fix overlapped memcpy in io_req_map_rw() (diff)
downloadlinux-4be1c615126963ade321492283c05fb653f55099.tar.xz
linux-4be1c615126963ade321492283c05fb653f55099.zip
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 <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ed7032bb76bf..f3d90a6108f8 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;