From 65d07408319b3fb69082ce387826880059c7e756 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 18 Aug 2017 12:50:34 -0400 Subject: [PATCH] drm/amdgpu/vce: adjust index offset removal Remove the index offset before adding the physical address to avoid a possible overflow if the offset is very large. bug: https://bugs.freedesktop.org/show_bug.cgi?id=102296 Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index c855366..5981646 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -581,9 +581,9 @@ static int amdgpu_vce_cs_reloc(struct amdgpu_cs_parser *p, uint32_t ib_idx, return -EINVAL; } + addr -= ((uint64_t)size) * ((uint64_t)index); addr -= mapping->start * AMDGPU_GPU_PAGE_SIZE; addr += amdgpu_bo_gpu_offset(bo); - addr -= ((uint64_t)size) * ((uint64_t)index); amdgpu_set_ib_value(p, ib_idx, lo, lower_32_bits(addr)); amdgpu_set_ib_value(p, ib_idx, hi, upper_32_bits(addr)); -- 2.5.5