* [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
@ 2025-11-05 15:47 Pavel Begunkov
2025-11-05 18:44 ` Jens Axboe
2025-11-05 18:45 ` Jens Axboe
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Begunkov @ 2025-11-05 15:47 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
->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;
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
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-05 18:45 ` Jens Axboe
1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-11-05 18:44 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
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-05 18:45 ` Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-11-05 18:45 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Wed, 05 Nov 2025 15:47:01 +0000, Pavel Begunkov wrote:
> ->nr_pages is int, it needs type extension before calculating the region
> size.
>
>
Applied, thanks!
[1/1] io_uring: fix types for region size calulation
commit: 1fd5367391bf0eeb09e624c4ab45121b54eaab96
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
2025-11-05 18:44 ` Jens Axboe
@ 2025-11-06 12:09 ` Pavel Begunkov
2025-11-06 23:23 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2025-11-06 12:09 UTC (permalink / raw)
To: Jens Axboe, io-uring
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.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH io_uring-6.18 1/1] io_uring: fix types for region size calulation
2025-11-06 12:09 ` Pavel Begunkov
@ 2025-11-06 23:23 ` Jens Axboe
0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-11-06 23:23 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-06 23:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-11-05 18:45 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox