Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: refactor rings_size nosqarray handling

A preparation patch inversing the IORING_SETUP_NO_SQARRAY check, this
way there is only one successful return path from the function, which
will be helpful later.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
e279bb4b ecb8490b

+13 -13
+13 -13
io_uring/io_uring.c
··· 2761 2761 unsigned int cq_entries, size_t *sq_offset) 2762 2762 { 2763 2763 struct io_rings *rings; 2764 - size_t off, sq_array_size; 2764 + size_t off; 2765 + 2766 + *sq_offset = SIZE_MAX; 2765 2767 2766 2768 off = struct_size(rings, cqes, cq_entries); 2767 2769 if (off == SIZE_MAX) ··· 2787 2785 return SIZE_MAX; 2788 2786 #endif 2789 2787 2790 - if (flags & IORING_SETUP_NO_SQARRAY) { 2791 - *sq_offset = SIZE_MAX; 2792 - return off; 2788 + if (!(flags & IORING_SETUP_NO_SQARRAY)) { 2789 + size_t sq_array_size; 2790 + 2791 + *sq_offset = off; 2792 + 2793 + sq_array_size = array_size(sizeof(u32), sq_entries); 2794 + if (sq_array_size == SIZE_MAX) 2795 + return SIZE_MAX; 2796 + if (check_add_overflow(off, sq_array_size, &off)) 2797 + return SIZE_MAX; 2793 2798 } 2794 - 2795 - *sq_offset = off; 2796 - 2797 - sq_array_size = array_size(sizeof(u32), sq_entries); 2798 - if (sq_array_size == SIZE_MAX) 2799 - return SIZE_MAX; 2800 - 2801 - if (check_add_overflow(off, sq_array_size, &off)) 2802 - return SIZE_MAX; 2803 2799 2804 2800 return off; 2805 2801 }