Skip to content

Commit 80626ae

Browse files
ColinIanKingDanilo Krummrich
authored andcommitted
drm/nouveau/gsp: Fix potential integer overflow on integer shifts
The left shift int 32 bit integer constants 1 is evaluated using 32 bit arithmetic and then assigned to a 64 bit unsigned integer. In the case where the shift is 32 or more this can lead to an overflow. Avoid this by shifting using the BIT_ULL macro instead. Fixes: 6c3ac7b ("drm/nouveau/gsp: support deeper page tables in COPY_SERVER_RESERVED_PDES") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2e3395a commit 80626ae

File tree

1 file changed

+1
-1
lines changed
  • drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535

1 file changed

+1
-1
lines changed

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ r535_mmu_vaspace_new(struct nvkm_vmm *vmm, u32 handle, bool external)
121121
page_shift -= desc->bits;
122122

123123
ctrl->levels[i].physAddress = pd->pt[0]->addr;
124-
ctrl->levels[i].size = (1 << desc->bits) * desc->size;
124+
ctrl->levels[i].size = BIT_ULL(desc->bits) * desc->size;
125125
ctrl->levels[i].aperture = 1;
126126
ctrl->levels[i].pageShift = page_shift;
127127

0 commit comments

Comments
 (0)