Skip to content

Commit a6711d1

Browse files
braunertehcaster
authored andcommitted
io_uring: port to struct kmem_cache_args
Port req_cachep to struct kmem_cache_args. Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Reviewed-by: Vlastimil Babka <[email protected]> Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 781aee7 commit a6711d1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

io_uring/io_uring.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,11 @@ SYSCALL_DEFINE2(io_uring_setup, u32, entries,
36383638

36393639
static int __init io_uring_init(void)
36403640
{
3641+
struct kmem_cache_args kmem_args = {
3642+
.useroffset = offsetof(struct io_kiocb, cmd.data),
3643+
.usersize = sizeof_field(struct io_kiocb, cmd.data),
3644+
};
3645+
36413646
#define __BUILD_BUG_VERIFY_OFFSET_SIZE(stype, eoffset, esize, ename) do { \
36423647
BUILD_BUG_ON(offsetof(stype, ename) != eoffset); \
36433648
BUILD_BUG_ON(sizeof_field(stype, ename) != esize); \
@@ -3722,12 +3727,9 @@ static int __init io_uring_init(void)
37223727
* range, and HARDENED_USERCOPY will complain if we haven't
37233728
* correctly annotated this range.
37243729
*/
3725-
req_cachep = kmem_cache_create_usercopy("io_kiocb",
3726-
sizeof(struct io_kiocb), 0,
3727-
SLAB_HWCACHE_ALIGN | SLAB_PANIC |
3728-
SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU,
3729-
offsetof(struct io_kiocb, cmd.data),
3730-
sizeof_field(struct io_kiocb, cmd.data), NULL);
3730+
req_cachep = kmem_cache_create("io_kiocb", sizeof(struct io_kiocb), &kmem_args,
3731+
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT |
3732+
SLAB_TYPESAFE_BY_RCU);
37313733
io_buf_cachep = KMEM_CACHE(io_buffer,
37323734
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
37333735

0 commit comments

Comments
 (0)