From: Jiadong.Zhu Date: Thu, 15 Sep 2022 07:19:20 +0000 (+0800) Subject: drm/amdgpu: Correct the position in patch_cond_exec X-Git-Tag: v6.6.17~6361^2~4^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=415be17fb2f4a70afc827332c936955b801085ad;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Jiadong.Zhu Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 34428e3..0320be4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -5429,7 +5429,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