From nobody Tue Apr 7 02:54:32 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 2A2C934D4EB for ; Mon, 16 Mar 2026 15:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773676179; cv=none; b=AoqSFfUdbOZCv7IFU0T1hKSemdGS7gZl5Ao1SClNoyvqPipXey0o8SBnohQD+ZQ3TVLVxX3+ssoZRIIMBkVgQo7XR05Glz5gHoOSZMCpbRVGFrnH+R2cqM1Wok+9rl9Mm5NfyBa9NQMa/xur7rPqRISj89itQBuLO6gS4w22gNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773676179; c=relaxed/simple; bh=xhj7V5VOHhyPhjZT8w+2BQtGE00MYdrzk3o+IvpVuEQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WM9MObNHaqRGEIRftmtqKLSMhwhL61gfOqHkikNxUlH/xoAF6aPNwcxM/L70MrA0gktMQ4c2Wc+4oCziSM2mUwqPM9bQFg4SIfIMy4I89B5n7MgcOYgoZRh6uSnmH52XNxhb+52mGpXvZSnJ2Wm7LShf+FYH1TFjZC2VRDkbiQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cKRe4kkC; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cKRe4kkC" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-82990763921so4414569b3a.1 for ; Mon, 16 Mar 2026 08:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773676177; x=1774280977; 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=I6uZPXtzqz7Sbxlt8I3hTrbR+x+36hfWguC11NiV9bo=; b=cKRe4kkC59oBmJ/78byqIkDm1LmxXNPPoJGE8qOKBJuQZUCnYTODgvPMoeLThip/gH cqtA+wF5+eH2EZECS59Udi4JZTc6pOhB1Xb3+hd79gnVLdOxmsIS9wwt/cLohLhKnYJk SJor9rSTQSIsr4Dbw0k44e8Dm6bahMoB7uUDQmhhnDcqu95UQX/XRomcik9/P16Btifk kuntQnF/vDpwF/5cptIlXTe+aanMzsuWtFmftowKxVncKxL+GqEDFxIGeQkcAgL2ZfJU /7+AbgolCVryXr6K2oEIt+5dz+39+J0H3e5FsNHWUiR8/jl4c6LtEFyby+lmigFcVP87 gckA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773676177; x=1774280977; 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=I6uZPXtzqz7Sbxlt8I3hTrbR+x+36hfWguC11NiV9bo=; b=H6qBHpYUwAkAfEYWzEU9Z0nKE8xDzSSwJmHA0XWdXbhoa1R7kxTNByValaUYx9lkVP J2saDKLOGF6eUGlFwqUvbmuIui0a7Xb1IM6dPz2KUIIky49gkWNwaxLTYwVK9SAu2uC8 yLrCOEznes7HTZJI6X/0xYM3EWv9HcQfVHsDeQGnJtXV3eCFu0YfRWXt6VuskqpUlJ6u 20m7NkanRX38iNE46l1pTijIFc2JQdtped9NdDGtuzDbOLb8FS/sEcVCgW2F54p1RFMz l4WP0JYGJD3X7DWIeQJz1gOxt8OY5sQXmOjpYnKg05TlePr5ke++UDiFSY4ddIqmwKRq JDXw== X-Forwarded-Encrypted: i=1; AJvYcCXRkGIaknT3jRcf7ZVZ4T2ueX+Ey5cS349k1xaFYKQVMl+UiLWMZjPfSjLBDoENnnq4q6gmDWRcq6vPS7E=@vger.kernel.org X-Gm-Message-State: AOJu0YzlMvpQ0Ekzd6OG1Ms1c5QfxOszepNTZyu8UlGZV+drtuH9TCAP ocWz4JTTuWRrzvN9ZnOP2mGj67Fm4Hc0wGB37J5FOiOxgbIgG/WJOFzG X-Gm-Gg: ATEYQzxIjF3EN9DmMVNAbO+nRVMu3D9p2WOC+gd0K1vNgM9efvMUiNkapkloZ9u33ca iFit7wfbxvwB9LHsg73BKSwCna2G5PnEFH4nYVIGb7RW+W3kzOOvB4zVJbWqNLezBSCj9zXeZLK MyFAWv/da14igkWYqZPOHO0Gcd+OJ+k1yz9lyXaxPb//0XB3l38AO8VNKolrid7tvoSpxqqsO/b 9XTtkVPVscwau2xSlC+UIN5Hofx7y13mY0mCBIagfeo1ONHzcALbSxLhL8DAEUdKQivn1yXgz1g vKBrtSwnfdUlxQnYfgEk7StMy7CcM3mmL6ztKr7pJSnUFj5Q8paX11gK01RkD8HZk3kjv7HnAqn WKR3I04FShgwEC92iLUBKQF0O9k3wcAea5DNgsNl6OccIPFQpbr6xwq4Ch1YLKnqI3ro+FXEG3q aI0CRJGTd6sx6qS3OQPJHzQFVy X-Received: by 2002:a05:6a20:a111:b0:398:72b7:ec8f with SMTP id adf61e73a8af0-398eca384d3mr12261294637.18.1773676177484; Mon, 16 Mar 2026 08:49:37 -0700 (PDT) Received: from ubuntu.. ([152.58.131.4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c73eb993e40sm9149350a12.8.2026.03.16.08.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 08:49:37 -0700 (PDT) From: Anas Iqbal To: Pavel Begunkov , Jens Axboe Cc: io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Anas Iqbal Subject: [PATCH] io_uring: cast id to u64 before shifting in io_allocate_rbuf_ring() Date: Mon, 16 Mar 2026 15:06:36 +0000 Message-ID: <20260316150636.2123-1-mohd.abd.6602@gmail.com> X-Mailer: git-send-email 2.43.0 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" Smatch warns: io_uring/zcrx.c:393 io_allocate_rbuf_ring() warn: should 'id << 16' be a 64= bit type? The expression 'id << IORING_OFF_PBUF_SHIFT' is evaluated using 32-bit arithmetic because id is a u32. This may overflow before being promoted to the 64-bit mmap_offset. Cast id to u64 before shifting to ensure the shift is performed in 64-bit arithmetic. Signed-off-by: Anas Iqbal --- io_uring/zcrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index 62d693287457..d96d2802f3da 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -390,7 +390,7 @@ static int io_allocate_rbuf_ring(struct io_ring_ctx *ct= x, return -EINVAL; =20 mmap_offset =3D IORING_MAP_OFF_ZCRX_REGION; - mmap_offset +=3D id << IORING_OFF_PBUF_SHIFT; + mmap_offset +=3D (u64)id << IORING_OFF_PBUF_SHIFT; =20 ret =3D io_create_region(ctx, &ifq->region, rd, mmap_offset); if (ret < 0) --=20 2.43.0