Skip to content

Commit 417d029

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: improve types for size calculation
Make sure io_import_umem() promotes the type to long before calculating the area size. While the area size is capped at 1GB by io_validate_user_buf_range() and fits into an "int", it's still too error prone. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent daa0b90 commit 417d029

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/zcrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
193193
return PTR_ERR(pages);
194194

195195
ret = sg_alloc_table_from_pages(&mem->page_sg_table, pages, nr_pages,
196-
0, nr_pages << PAGE_SHIFT,
196+
0, (unsigned long)nr_pages << PAGE_SHIFT,
197197
GFP_KERNEL_ACCOUNT);
198198
if (ret) {
199199
unpin_user_pages(pages, nr_pages);

0 commit comments

Comments
 (0)