[AMD Official Use Only - Internal Distribution Only]

adev->serial which is used to hold the final serial number may need to be 
enlarged also.
Since it comes with 16 bytes also.

BR,
Evan
-----Original Message-----
From: Dan Carpenter <dan.carpen...@oracle.com>
Sent: Monday, June 8, 2020 10:18 PM
To: Quan, Evan <evan.q...@amd.com>; Russell, Kent <kent.russ...@amd.com>
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Koenig, Christian 
<christian.koe...@amd.com>; David Airlie <airl...@linux.ie>; Daniel Vetter 
<dan...@ffwll.ch>; amd-gfx@lists.freedesktop.org; 
kernel-janit...@vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: Fix buffer overflow in 
arcturus_get_unique_id()

The comments say that the "sn" buffer is used to hold a 16-digit HEX string so 
the buffer needs to be at least 17 characters to hold the NUL terminator.

Fixes: 81a16241114b ("drm/amdgpu: Add unique_id and serial_number for Arcturus 
v3")
Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index df7b408319f76..a575cb9d1574c 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2266,7 +2266,7 @@ static void arcturus_get_unique_id(struct smu_context 
*smu)  {
 struct amdgpu_device *adev = smu->adev;
 uint32_t top32, bottom32, smu_version, size;
-char sn[16];
+char sn[20];
 uint64_t id;

 if (smu_get_smc_version(smu, NULL, &smu_version)) {
--
2.26.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to