Skip to contentSkip to conversation

drm/amdgpu: fix out of bounds memcpy

PATCH In review Christian König 2 participants 2 messages Apr 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix out of bounds memcpy

The buffer needs to be two bytes larger when the maximum is 32.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +1 -1
index 9d17761721de..c7e55fe170bd 100644
@@ -85,7 +85,7 @@ int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
 
 int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 {
-	unsigned char buff[32];
+	unsigned char buff[34];
 	int addrptr = 0, size = 0;
 
 	if (!is_fru_eeprom_supported(adev))
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by Nirmoy Das on v1 1/1
#1 lore raw
Quoted 3 lines · Christian König

The buffer needs to be two bytes larger when the maximum is 32.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +0 -0
index 9d17761721de..c7e55fe170bd 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · line 91

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +1 -1
@@ -85,7 +85,7 @@ int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
 
  int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
  {
-	unsigned char buff[32];
+	unsigned char buff[34];
  	int addrptr = 0, size = 0;
 
  	if (!is_fru_eeprom_supported(adev))

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx