]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/rsrc: take unsigned index in io_rsrc_node_lookup()
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 22 Jan 2026 21:45:04 +0000 (14:45 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 22 Jan 2026 22:58:17 +0000 (15:58 -0700)
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>
io_uring/rsrc.h

index d603f6a47f5e221d6465d1c49e526b4f80d5bb8a..4a5db2ad1af2cd82772dd6d937713bbfeee2c922 100644 (file)
@@ -90,7 +90,7 @@ bool io_check_coalesce_buffer(struct page **page_array, int nr_pages,
                              struct io_imu_folio_data *data);
 
 static inline struct io_rsrc_node *io_rsrc_node_lookup(struct io_rsrc_data *data,
-                                                      int index)
+                                                      unsigned int index)
 {
        if (index < data->nr)
                return data->nodes[array_index_nospec(index, data->nr)];