summaryrefslogtreecommitdiffstats
path: root/io_uring/rsrc.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-06-15 18:33:47 +0200
committerJens Axboe <axboe@kernel.dk>2022-07-25 02:39:12 +0200
commit5ff4fdffad483dad815b3701be8b82c5a07b156e (patch)
treef634825df531f5505d7a0739935f794d5180ac98 /io_uring/rsrc.c
parentio_uring: deprecate epoll_ctl support (diff)
downloadlinux-5ff4fdffad483dad815b3701be8b82c5a07b156e.tar.xz
linux-5ff4fdffad483dad815b3701be8b82c5a07b156e.zip
io_uring: make reg buf init consistent
The default (i.e. empty) state of register buffer is dummy_ubuf, so set it to dummy on init instead of NULL. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/c5456aecf03d9627fbd6e65e100e2b5293a6151e.1655310733.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rsrc.c')
-rw-r--r--io_uring/rsrc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 8c40b20659d4..214ff0dfa6a4 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -567,7 +567,7 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
io_buffer_unmap(ctx, &imu);
break;
}
- ctx->user_bufs[i] = NULL;
+ ctx->user_bufs[i] = ctx->dummy_ubuf;
needs_switch = true;
}
@@ -1203,14 +1203,11 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
size_t size;
int ret, nr_pages, i;
- if (!iov->iov_base) {
- *pimu = ctx->dummy_ubuf;
+ *pimu = ctx->dummy_ubuf;
+ if (!iov->iov_base)
return 0;
- }
- *pimu = NULL;
ret = -ENOMEM;
-
pages = io_pin_pages((unsigned long) iov->iov_base, iov->iov_len,
&nr_pages);
if (IS_ERR(pages)) {