io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
Date: Thu, 6 Nov 2025 16:23:53 -0700	[thread overview]
Message-ID: <a4cbaa8b-0bfb-46b9-a932-86b740ef8ce0@kernel.dk> (raw)
In-Reply-To: <5db63478-cd4f-4a6c-a694-3c39a5f38571@gmail.com>

On 11/6/25 5:09 AM, Pavel Begunkov wrote:
> On 11/5/25 18:44, Jens Axboe wrote:
>> On 11/5/25 8:47 AM, Pavel Begunkov wrote:
>>> ->nr_pages is int, it needs type extension before calculating the region
>>> size.
>>>
>>> Fixes: a90558b36ccee ("io_uring/memmap: helper for pinning region pages")
>>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>>> ---
>>>   io_uring/memmap.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/io_uring/memmap.c b/io_uring/memmap.c
>>> index 2e99dffddfc5..fab79c7b3157 100644
>>> --- a/io_uring/memmap.c
>>> +++ b/io_uring/memmap.c
>>> @@ -135,7 +135,7 @@ static int io_region_pin_pages(struct io_ring_ctx *ctx,
>>>                   struct io_mapped_region *mr,
>>>                   struct io_uring_region_desc *reg)
>>>   {
>>> -    unsigned long size = mr->nr_pages << PAGE_SHIFT;
>>> +    unsigned long size = (size_t)mr->nr_pages << PAGE_SHIFT;
>>>       struct page **pages;
>>>       int nr_pages;
>>
>> Should probably consistently use a size_t, everywhere else does. Doesn't
>> matter here as io_pin_pages() does the right thing anyway.
> 
> I have a patch on the topic as I needed it myself, but didn't
> include it into the fix.

That's fine, better that way too imho.

-- 
Jens Axboe


  reply	other threads:[~2025-11-06 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 15:47 [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation Pavel Begunkov
2025-11-05 18:44 ` Jens Axboe
2025-11-06 12:09   ` Pavel Begunkov
2025-11-06 23:23     ` Jens Axboe [this message]
2025-11-05 18:45 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4cbaa8b-0bfb-46b9-a932-86b740ef8ce0@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).