drm/amdgpu: fix memory overflow in the IB test
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: fix memory overflow in the IB test
Fix a memory overflow issue in the gfx IB test for some ASICs. At least 20 bytes are needed for the IB test packet.
v2: correct code indentation errors. (Christian)
Signed-off-by Tim Huang <[email protected]>
Reviewed-by Yifan Zhang <[email protected]>
Reviewed-by Christian König <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -1
@@ -419,7 +419,7 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) adev->wb.wb[index] =cpu_to_le32 (0xCAFEDEAD ); cpu_ptr = &adev->wb.wb[index]; - r =amdgpu_ib_get (adev,NULL ,16 ,AMDGPU_IB_POOL_DIRECT , &ib); + r =amdgpu_ib_get (adev,NULL ,20 ,AMDGPU_IB_POOL_DIRECT , &ib);if (r) {DRM_ERROR ("amdgpu: failed to get ib (%ld).\n" , r); goto err1;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
@@ -883,8 +883,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) gpu_addr = adev->wb.gpu_addr + (index *4 ); adev->wb.wb[index] =cpu_to_le32 (0xCAFEDEAD );memset (&ib,0 ,sizeof (ib)); - r =amdgpu_ib_get (adev,NULL ,16 , -AMDGPU_IB_POOL_DIRECT , &ib); + + r =amdgpu_ib_get (adev,NULL ,20 ,AMDGPU_IB_POOL_DIRECT , &ib);if (r) goto err1;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
@@ -1039,8 +1039,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) gpu_addr = adev->wb.gpu_addr + (index *4 ); adev->wb.wb[index] =cpu_to_le32 (0xCAFEDEAD );memset (&ib,0 ,sizeof (ib)); - r =amdgpu_ib_get (adev,NULL ,16 , -AMDGPU_IB_POOL_DIRECT , &ib); + + r =amdgpu_ib_get (adev,NULL ,20 ,AMDGPU_IB_POOL_DIRECT , &ib);if (r) goto err1;
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
@@ -297,8 +297,8 @@ static int gfx_v9_4_3_ring_test_ib(struct amdgpu_ring *ring, long timeout) gpu_addr = adev->wb.gpu_addr + (index *4 ); adev->wb.wb[index] =cpu_to_le32 (0xCAFEDEAD );memset (&ib,0 ,sizeof (ib)); - r =amdgpu_ib_get (adev,NULL ,16 , -AMDGPU_IB_POOL_DIRECT , &ib); + + r =amdgpu_ib_get (adev,NULL ,20 ,AMDGPU_IB_POOL_DIRECT , &ib);if (r) goto err1;
Signature · 1 line
2.39.2