Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks

io_uring_cmd_prep() checks that REQ_F_BUFFER_SELECT is set in the
io_kiocb's flags iff IORING_URING_CMD_MULTISHOT is set in the SQE's
uring_cmd_flags. Consolidate the IORING_URING_CMD_MULTISHOT and
!IORING_URING_CMD_MULTISHOT branches into a single check that the
IORING_URING_CMD_MULTISHOT flag matches the REQ_F_BUFFER_SELECT flag.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250821163308.977915-4-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
e5c717e7 3484f530

+3 -7
+3 -7
io_uring/uring_cmd.c
··· 201 201 req->buf_index = READ_ONCE(sqe->buf_index); 202 202 } 203 203 204 - if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) { 205 - if (!(req->flags & REQ_F_BUFFER_SELECT)) 206 - return -EINVAL; 207 - } else { 208 - if (req->flags & REQ_F_BUFFER_SELECT) 209 - return -EINVAL; 210 - } 204 + if (!!(ioucmd->flags & IORING_URING_CMD_MULTISHOT) != 205 + !!(req->flags & REQ_F_BUFFER_SELECT)) 206 + return -EINVAL; 211 207 212 208 ioucmd->cmd_op = READ_ONCE(sqe->cmd_op); 213 209