From 7927dbcf9f8ce7ba7c83dd9d886565d045ba4fe8 Mon Sep 17 00:00:00 2001 From: liyouhong Date: Sat, 27 Jun 2026 11:27:31 +0800 Subject: [PATCH] block: assert blk_iou_cmd fits in the io_uring_cmd PDU blk_iou_cmd is stored in io_uring_cmd->pdu via io_uring_cmd_to_pdu() for block device io_uring commands (e.g. discard). The PDU is only 32 bytes inline storage; add a static_assert matching scsi_bsg.c so that future struct growth cannot silently overflow it. Signed-off-by: liyouhong --- block/ioctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index 3d4ea1537457d..ad0b7b9815e96 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -856,12 +856,17 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) } #endif +/* + * Per-command block io_uring PDU stored in io_uring_cmd.pdu[32]. + * Holds discard state between submission, completion and task work. + */ struct blk_iou_cmd { u64 start; u64 len; int res; bool nowait; }; +static_assert(sizeof(struct blk_iou_cmd) <= sizeof_field(struct io_uring_cmd, pdu)); static void blk_cmd_complete(struct io_tw_req tw_req, io_tw_token_t tw) {