mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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>
This commit is contained in:
committed by
Jens Axboe
parent
daa0b901f8
commit
417d029dc4
@@ -193,7 +193,7 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
|
||||
return PTR_ERR(pages);
|
||||
|
||||
ret = sg_alloc_table_from_pages(&mem->page_sg_table, pages, nr_pages,
|
||||
0, nr_pages << PAGE_SHIFT,
|
||||
0, (unsigned long)nr_pages << PAGE_SHIFT,
|
||||
GFP_KERNEL_ACCOUNT);
|
||||
if (ret) {
|
||||
unpin_user_pages(pages, nr_pages);
|
||||
|
||||
Reference in New Issue
Block a user