diff options
| author | Caleb Sander Mateos <csander@purestorage.com> | 2025-08-21 19:33:08 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-08-24 20:41:12 +0300 |
| commit | e5c717e7953b688049cdc2a2a474e4905e0da3c0 (patch) | |
| tree | 04843fea04dcb80358ca2a4328f4bb99cd4b966a /io_uring/uring_cmd.c | |
| parent | 3484f530f8d9da08b71d1e604dcd4ab8868d9919 (diff) | |
| download | linux-e5c717e7953b688049cdc2a2a474e4905e0da3c0.tar.xz | |
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>
Diffstat (limited to 'io_uring/uring_cmd.c')
| -rw-r--r-- | io_uring/uring_cmd.c | 10 |
1 files 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 @@ -201,13 +201,9 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 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); |
