Skip to content

Commit 9a57fff

Browse files
isilenceaxboe
authored andcommitted
io_uring/rsrc: clean up __io_sqe_buffers_update()
Inline offset variable, so we don't use it without subjecting it to array_index_nospec() first. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/77936d9ed23755588810c5eafcea7e1c3b90e3cd.1681395792.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 2f2af35 commit 9a57fff

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

io_uring/rsrc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
469469

470470
for (done = 0; done < nr_args; done++) {
471471
struct io_mapped_ubuf *imu;
472-
int offset = up->offset + done;
473472
u64 tag = 0;
474473

475474
err = io_copy_iov(ctx, &iov, iovs, done);
@@ -490,7 +489,7 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx,
490489
if (err)
491490
break;
492491

493-
i = array_index_nospec(offset, ctx->nr_user_bufs);
492+
i = array_index_nospec(up->offset + done, ctx->nr_user_bufs);
494493
if (ctx->user_bufs[i] != ctx->dummy_ubuf) {
495494
err = io_queue_rsrc_removal(ctx->buf_data, i,
496495
ctx->rsrc_node, ctx->user_bufs[i]);

0 commit comments

Comments
 (0)