Skip to contentSkip to conversation

drm/amdgpu: Fix the incomplete product number

PATCH In review Roy Sun 3 participants 6 messages Jul 20, 2022

Subsystems (2)
lore
Share & tools
lore

Roy Sun

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix the incomplete product number

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index 9f729a648005..187e3dae3965 100644
@@ -1019,7 +1019,7 @@ struct amdgpu_device {
 	bool                            psp_sysfs_en;
 
 	/* Chip product information */
-	char				product_number[16];
+	char				product_number[20];
 	char				product_name[AMDGPU_PRODUCT_NAME_LEN];
 	char				serial[20];
 
Signature · 1 line
2.34.1
author
#1 lore raw

[AMD Official Use Only - General]

Double checked.

BR
Roy
________________________________
From: Roy Sun <[email protected]>
Sent: Wednesday, July 20, 2022 4:26 PM
To: [email protected] <[email protected]>
Cc: Sun, Roy <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix the incomplete product number

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index 9f729a648005..187e3dae3965 100644
@@ -1019,7 +1019,7 @@ struct amdgpu_device {
         bool                            psp_sysfs_en;
 
         /* Chip product information */
-       char                            product_number[16];
+       char                            product_number[20];
         char                            product_name[AMDGPU_PRODUCT_NAME_LEN];
         char                            serial[20];
 

--
2.34.1

Acked-by on v1 1/1
#2 lore raw
In reply to Roy Sun

Am 20.07.22 um 10:26 schrieb Roy Sun:

Quoted 4 lines

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

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index 9f729a648005..187e3dae3965 100644
@@ -1019,7 +1019,7 @@ struct amdgpu_device {
  	bool                            psp_sysfs_en;
 
  	/* Chip product information */
-	char				product_number[16];
+	char				product_number[20];
  	char				product_name[AMDGPU_PRODUCT_NAME_LEN];
  	char				serial[20];
 
#3 lore raw
In reply to Roy Sun

Às 05:26 de 20/07/22, Roy Sun escreveu:

Quoted 3 lines

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

Which comment?

Quoted 10 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 9f729a648005..187e3dae3965 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1022

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1019,7 +1019,7 @@ struct amdgpu_device {
 	bool                            psp_sysfs_en;
 
 	/* Chip product information */
-	char				product_number[16];
+	char				product_number[20];

If 17 is enough, why setting as 20?

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
 	char				product_name[AMDGPU_PRODUCT_NAME_LEN];
 	char				serial[20];
 
#4 lore raw

Am 20.07.22 um 16:26 schrieb André Almeida:

Quoted 5 lines

Às 05:26 de 20/07/22, Roy Sun escreveu:

Quoted 3 lines

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

Which comment?

In internal documentation of the eeprom layout I think.

Quoted 13 lines
Quoted 13 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 9f729a648005..187e3dae3965 100644
@@ -1019,7 +1019,7 @@ struct amdgpu_device {
  	bool                            psp_sysfs_en;
 
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1022

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
  	/* Chip product information */
-	char				product_number[16];
+	char				product_number[20];

If 17 is enough, why setting as 20?

That's the next multiple of 4 and so avoids alignment issues.

Christian.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
  	char				product_name[AMDGPU_PRODUCT_NAME_LEN];
  	char				serial[20];