[PATCH] drm/amdgpu: Fix incorrect firmware size calculation

Quan, Evan Evan.Quan at amd.com
Tue Jun 16 03:26:07 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Acked-by: Evan Quan <evan.quan at amd.com>

From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Guo Lei
Sent: Monday, June 15, 2020 3:14 PM
To: amd-gfx at lists.freedesktop.org
Subject: [PATCH] drm/amdgpu: Fix incorrect firmware size calculation


>From 014162f69b909a59c241e7f73c3630d1da34696c Mon Sep 17 00:00:00 2001

From: Lei Guo <raykwok1150 at 163.com<mailto:raykwok1150 at 163.com>>

Date: Mon, 15 Jun 2020 13:54:26 +0800

Subject: [PATCH] drm/amdgpu: Fix incorrect firmware size calculation



[WHY]

The memcpy() function copies n bytes from memory area src to memory area

dest. So specify the firmware size in bytes.



[How]

Correct the calculation.



Signed-off-by: Lei Guo <raykwok1150 at 163.com<mailto:raykwok1150 at 163.com>>

Reviewed-by: Junwei Zhang <zjunweihit at 163.com<mailto:zjunweihit at 163.com>>

---

 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index 6b94587df407..c3e59b765268 100644

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

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

@@ -1960,7 +1960,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)

          fw_data = (const __le32 *)

                      (adev->gfx.mec_fw->data +

                      le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes));

-         fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4;

+        fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes);



          r = amdgpu_bo_create_reserved(adev, mec_hdr->header.ucode_size_bytes,

                                                    PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,

--

2.17.1




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200616/572de766/attachment-0001.htm>


More information about the amd-gfx mailing list