Skip to content

Commit eaf72f7

Browse files
committed
io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout
A few spots in uring_cmd assume that the SQEs copied are always at the start of the structure, and hence mix req->async_data and the struct itself. Clean that up and use the proper indices. Signed-off-by: Jens Axboe <[email protected]>
1 parent d58d82b commit eaf72f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

io_uring/uring_cmd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
192192
return 0;
193193
}
194194

195-
memcpy(req->async_data, sqe, uring_sqe_size(req->ctx));
196-
ioucmd->sqe = req->async_data;
195+
memcpy(cache->sqes, sqe, uring_sqe_size(req->ctx));
196+
ioucmd->sqe = cache->sqes;
197197
return 0;
198198
}
199199

@@ -260,7 +260,7 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
260260
struct io_uring_cmd_data *cache = req->async_data;
261261

262262
if (ioucmd->sqe != (void *) cache)
263-
memcpy(cache, ioucmd->sqe, uring_sqe_size(req->ctx));
263+
memcpy(cache->sqes, ioucmd->sqe, uring_sqe_size(req->ctx));
264264
return -EAGAIN;
265265
} else if (ret == -EIOCBQUEUED) {
266266
return -EIOCBQUEUED;

0 commit comments

Comments
 (0)