From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Tim Huang <Tim.Huang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Yifan1.zhang@amd.com
Subject: Re: [PATCH] drm/amdgpu: fix memory overflow in the IB test
Date: Tue, 21 Nov 2023 15:38:20 +0100 [thread overview]
Message-ID: <b7e49776-787a-40da-9f96-8de2b5debdfa@gmail.com> (raw)
In-Reply-To: <20231121062533.664725-1-Tim.Huang@amd.com>
Am 21.11.23 um 07:25 schrieb Tim Huang:
> Fix a memory overflow issue in the gfx IB test
> for some ASICs. At least 20 bytes are needed for
> the IB test packet.
>
> Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Good catch.
> ---
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 0c6133cc5e57..f281eecaeeec 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -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;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 885ebd703260..4b0eda46405f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -883,7 +883,7 @@ 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,
> + r = amdgpu_ib_get(adev, NULL, 20,
> AMDGPU_IB_POOL_DIRECT, &ib);
Not the fault of your patch, but the indentation here and below seems to
be wrong, please check your patch with checkpatch.pl.
When you don't get a warning feel free to add Reviewed-by: Christian
König <christian.koenig@amd.com>.
Regards,
Christian.
> if (r)
> goto err1;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index e3ff6e46f3f7..a55710bf6e01 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -1039,7 +1039,7 @@ 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,
> + r = amdgpu_ib_get(adev, NULL, 20,
> AMDGPU_IB_POOL_DIRECT, &ib);
> if (r)
> goto err1;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> index 40d06d32bb74..603988e49cd5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> @@ -297,7 +297,7 @@ 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,
> + r = amdgpu_ib_get(adev, NULL, 20,
> AMDGPU_IB_POOL_DIRECT, &ib);
> if (r)
> goto err1;
prev parent reply other threads:[~2023-11-21 14:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 6:25 [PATCH] drm/amdgpu: fix memory overflow in the IB test Tim Huang
2023-11-21 6:57 ` Zhang, Yifan
2023-11-21 14:38 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7e49776-787a-40da-9f96-8de2b5debdfa@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=Tim.Huang@amd.com \
--cc=Yifan1.zhang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox