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 --- io_uring/uring_cmd.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index c8fd204f6892..482cc5be1f8d 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -199,17 +199,13 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) return -EINVAL; req->buf_index = READ_ONCE(sqe->buf_index); } - if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) { - if (!(req->flags & REQ_F_BUFFER_SELECT)) - return -EINVAL; - } else { - if (req->flags & REQ_F_BUFFER_SELECT) - return -EINVAL; - } + if (!!(ioucmd->flags & IORING_URING_CMD_MULTISHOT) != + !!(req->flags & REQ_F_BUFFER_SELECT)) + return -EINVAL; ioucmd->cmd_op = READ_ONCE(sqe->cmd_op); ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req); if (!ac) -- 2.45.2