From nobody Sat Feb 7 22:55:15 2026 Received: from mail-qk1-f228.google.com (mail-qk1-f228.google.com [209.85.222.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7859938551A for ; Thu, 22 Jan 2026 21:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769118320; cv=none; b=VZB+f7LsbftLpD0mgmGmbl/9U37iWRCi5JxLwVKFqS3IXm367F0/9qAx7qDebjMBAi5jE+A+QsshcABL41K84mbPSG8Zj0RCVMLQ+T3nou6q3NzvF3G/yoJDYukQfaKgaGjslyKQCbB1e+ERvg4O9r2U0eGGfd6HuZD/z4O+LUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769118320; c=relaxed/simple; bh=LbXg6ikigd7m35dkXWzyE1HtQnksbRISnpxx2+K+xRU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jnWWKrb7Ls2ivCxQzWD1Kjc+N3C+/cIvuGIFGxsy8m6dSiuOX7g357ZFHPO3NkWQNdQnGKK4KBWARDl7bLJLTFPEHu4/yqn9uESCWSSCoUFxO0iehBo+pFjaLBqSzabD20Ib26MvJIA6OyKaIXToZM7O9rNTvlx3zCmyU2M5Gys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=e3L57Ppl; arc=none smtp.client-ip=209.85.222.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="e3L57Ppl" Received: by mail-qk1-f228.google.com with SMTP id af79cd13be357-8c5339e51a1so13235085a.1 for ; Thu, 22 Jan 2026 13:45:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1769118309; x=1769723109; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=t6txbsgs8HpHiW8iS6Y8jI3CsFaklT7+HURLNdFd524=; b=e3L57Pplq7XI2bikqPb0CEi2qa2KR40SHxsaMHL0rozNbyrv0Q+j4RfjPu4Nx8hQd2 7mr4abHvMNVs8d4BLa/8K29MnY3i8Ec5qEP7ccDLlMov8uzqjvkq6wmeY3/mUce9sL9Z 5jvDWbJctB27EKfJU+XbBfeBRBZrFE11xEdcWNw6TDWgrekEvrZmIPFOkZjv9QpXnzmY nN5S6FF5VoFFPChefMxS2sdUyD+O4ZrC/5rzk2scc2663k897L0ne5XmP9yt/hBzgVpD GEXbo11Cv1ZRiyf2X8qk6DtBt6DaQwy+5BRKYOLzpCTm37TzJTSZRGiMrWXiCMwEhdtb C/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769118309; x=1769723109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=t6txbsgs8HpHiW8iS6Y8jI3CsFaklT7+HURLNdFd524=; b=KE+a/5H8x1ZyNwT9Jb+KmYK74azJc6BLZEE9KFAAdb6R22h6GbOhZTnCbw9URVVJUC hd5V2m8nReJL97vbASpcVqkAS11gQF0jKIeORrexye8SyfgS+fZmgvTeMf6tb1/48XY+ gmv59wThL8XZGq5pg2JV9WXlB5ljd6G8Pktk5VZPgNCKSwwLgI/JAMyfC8GzwjoN8RZN e8vQy0ID/oWr8or78g9gfrw3U5wNCFV/V9zr9TdtdWWp2y9wyUXIJfcx/EI9/9GUog5g bSJh67hirkJMU170nQQ66epk9Kx4mKcI9y4oQgOumSq8rDlhceipFPwjxfJiEOWrFtaa OuRg== X-Forwarded-Encrypted: i=1; AJvYcCWRKfJZefHdD4XCc90JauUoKHGncmm1Q/0V9qgCRMGvDJ0e6/ZbAghzzuNoIhKgZBvs+puBeTc9zuOdHZE=@vger.kernel.org X-Gm-Message-State: AOJu0YyjeNAocgSbAXHkLrZNEdnIQ6yDvqKMI8vPOpT4kAuRgdEdK1eG rd2qYgmAu80/NgqSwBdl2tGec/88nYdZGrwIbtZHTyp/biFBxjSrIr0KEvAJWspwInWCC2lPDvu NeM6LfdoQEBBu6Tclcf7piKWONoXpDdW5IbRx X-Gm-Gg: AZuq6aL5o48jhbv4km+s71rchK4Q+JL9FU3qkvhHHdNXWr2x3mU7alg58iclE6aHw9R dNQxICkrnrlla6JRWi3LpQ/fTHgGDwm2cKSP3UKFru085TXrGxZZZO4eY7Gpf9/3JbG5H8fZp4b o/psFbc1WBHLGDx9LziPtco0DH/9ftMjwAKODg7bFHL8G+jiKPauma6sKo6pQEv13aS6R/VHg7b wffoWpzNrci0BZhTEs2VYdGKhVfiGX/4pQhe1tVN6C4Pq+tUrsehkftf9yHlmqMnDVcJUDnYlNg wQk5+87xl+qKmmpWiy8fXokuAC0XWVleY5Q8sisepNlfVVW1RYLFn0KUGvpfhF978V9RCMvRKAr FsW/r4SfNJok3pDVYEzTsRjoL5x4XdH03lcvBMDBFEw== X-Received: by 2002:a05:620a:29d3:b0:8b2:df32:b900 with SMTP id af79cd13be357-8c6e2d95f5cmr97390285a.4.1769118309206; Thu, 22 Jan 2026 13:45:09 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 6a1803df08f44-8949187ffd9sm527916d6.20.2026.01.22.13.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 13:45:09 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.30.204]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 93B7D340572; Thu, 22 Jan 2026 14:45:08 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 8113CE41BBE; Thu, 22 Jan 2026 14:45:08 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] io_uring/rsrc: take unsigned index in io_rsrc_node_lookup() Date: Thu, 22 Jan 2026 14:45:04 -0700 Message-ID: <20260122214506.88529-1-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- io_uring/rsrc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index d603f6a47f5e..4a5db2ad1af2 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -88,11 +88,11 @@ int io_validate_user_buf_range(u64 uaddr, u64 ulen); =20 bool io_check_coalesce_buffer(struct page **page_array, int nr_pages, struct io_imu_folio_data *data); =20 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)]; return NULL; } --=20 2.45.2