Skip to content

Commit 82dadc8

Browse files
calebsanderaxboe
authored andcommitted
io_uring/rsrc: take unsigned index in io_rsrc_node_lookup()
io_rsrc_node_lookup() takes a signed int index as input and compares it to an unsigned length. Since the signed int is implicitly cast to an unsigned int for the comparison and the length is bounded by IORING_MAX_FIXED_FILES/IORING_MAX_REG_BUFFERS, negative indices are already rejected on architectures where int is at least 32 bits. Make this a bit clearer and avoid compiler warnings for comparisons of signed and unsigned values by taking an unsigned int index instead. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 5247c03 commit 82dadc8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

io_uring/rsrc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool io_check_coalesce_buffer(struct page **page_array, int nr_pages,
9090
struct io_imu_folio_data *data);
9191

9292
static inline struct io_rsrc_node *io_rsrc_node_lookup(struct io_rsrc_data *data,
93-
int index)
93+
unsigned int index)
9494
{
9595
if (index < data->nr)
9696
return data->nodes[array_index_nospec(index, data->nr)];

0 commit comments

Comments
 (0)