Skip to content

Commit b0d658e

Browse files
isilenceaxboe
authored andcommitted
io_uring: add more build check for uapi
Add a couple of BUILD_BUG_ON() checking some rsrc uapi structs and SQE flags. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/ff960df4d5026b9fb5bfd80994b9d3667d3926da.1619536280.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent dddca22 commit b0d658e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

fs/io_uring.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10134,6 +10134,13 @@ static int __init io_uring_init(void)
1013410134
BUILD_BUG_SQE_ELEM(42, __u16, personality);
1013510135
BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in);
1013610136

10137+
BUILD_BUG_ON(sizeof(struct io_uring_files_update) !=
10138+
sizeof(struct io_uring_rsrc_update));
10139+
BUILD_BUG_ON(sizeof(struct io_uring_rsrc_update) >
10140+
sizeof(struct io_uring_rsrc_update2));
10141+
/* should fit into one byte */
10142+
BUILD_BUG_ON(SQE_VALID_FLAGS >= (1 << 8));
10143+
1013710144
BUILD_BUG_ON(ARRAY_SIZE(io_op_defs) != IORING_OP_LAST);
1013810145
BUILD_BUG_ON(__REQ_F_LAST_BIT >= 8 * sizeof(int));
1013910146
req_cachep = KMEM_CACHE(io_kiocb, SLAB_HWCACHE_ALIGN | SLAB_PANIC |

0 commit comments

Comments
 (0)