aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiadong.Zhu <Jiadong.Zhu@amd.com>2022-09-15 15:19:20 +0800
committerAlex Deucher <alexander.deucher@amd.com>2022-09-27 18:02:58 -0400
commitb3e45b18e5c40f1f7e5f6383953343f96f963b13 (patch)
treef8cdd0fa3818f93432ee73db759a9424d5f037f2
parent2d3907c152611a0d65efe54b93972320dcce1565 (diff)
downloadlinux-sgx-b3e45b18e5c40f1f7e5f6383953343f96f963b13.tar.gz
drm/amdgpu: Correct the position in patch_cond_exec
The current position calulated in gfx_v9_0_ring_emit_patch_cond_exec underflows when the wptr is divisible by ring->buf_mask + 1. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Jiadong.Zhu <Jiadong.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index fc9c1043244cb3..037af835267733 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -5597,7 +5597,7 @@ static void gfx_v9_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigne
BUG_ON(offset > ring->buf_mask);
BUG_ON(ring->ring[offset] != 0x55aa55aa);
- cur = (ring->wptr & ring->buf_mask) - 1;
+ cur = (ring->wptr - 1) & ring->buf_mask;
if (likely(cur > offset))
ring->ring[offset] = cur - offset;
else