Skip to content

Commit 6b0b778

Browse files
Tim Huangalexdeucher
authored andcommitted
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]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 5c908a3 commit 6b0b778

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
427427
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
428428
cpu_ptr = &adev->wb.wb[index];
429429

430-
r = amdgpu_ib_get(adev, NULL, 16, AMDGPU_IB_POOL_DIRECT, &ib);
430+
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
431431
if (r) {
432432
DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
433433
goto err1;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
883883
gpu_addr = adev->wb.gpu_addr + (index * 4);
884884
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
885885
memset(&ib, 0, sizeof(ib));
886-
r = amdgpu_ib_get(adev, NULL, 16,
887-
AMDGPU_IB_POOL_DIRECT, &ib);
886+
887+
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
888888
if (r)
889889
goto err1;
890890

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
10391039
gpu_addr = adev->wb.gpu_addr + (index * 4);
10401040
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
10411041
memset(&ib, 0, sizeof(ib));
1042-
r = amdgpu_ib_get(adev, NULL, 16,
1043-
AMDGPU_IB_POOL_DIRECT, &ib);
1042+
1043+
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
10441044
if (r)
10451045
goto err1;
10461046

drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ static int gfx_v9_4_3_ring_test_ib(struct amdgpu_ring *ring, long timeout)
297297
gpu_addr = adev->wb.gpu_addr + (index * 4);
298298
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
299299
memset(&ib, 0, sizeof(ib));
300-
r = amdgpu_ib_get(adev, NULL, 16,
301-
AMDGPU_IB_POOL_DIRECT, &ib);
300+
301+
r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib);
302302
if (r)
303303
goto err1;
304304

0 commit comments

Comments
 (0)