drm/amdgpu: Fix size overflow

ttm->num_pages is uint32. Hit overflow when << PAGE_SHIFT directly

Fixes: 230c079fdc ("drm/ttm: make num_pages uint32_t")
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
xinhui pan 2021-04-07 19:29:39 +08:00 committed by Alex Deucher
parent d844c6d747
commit b16e685725
1 changed files with 1 additions and 1 deletions

View File

@ -830,7 +830,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,
/* Allocate an SG array and squash pages into it */ /* Allocate an SG array and squash pages into it */
r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0, r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
ttm->num_pages << PAGE_SHIFT, (u64)ttm->num_pages << PAGE_SHIFT,
GFP_KERNEL); GFP_KERNEL);
if (r) if (r)
goto release_sg; goto release_sg;