[PATCH] drm/amdgpu/eeprom: fix possible read overflow in memcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The size could be up to 32 bytes and we start from index 2.

In file included from ./include/linux/uuid.h:12,
                 from ./include/linux/mod_devicetable.h:13,
                 from ./include/linux/pci.h:27,
                 from drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c:23:
In function ‘memcpy’,
    inlined from ‘amdgpu_fru_get_product_info’ at drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c:137:2:
./include/linux/string.h:376:4: error: call to ‘__read_overflow2’ declared with attribute error: detected read beyond size of object passed as 2nd parameter
  376 |    __read_overflow2();
      |    ^~~~~~~~~~~~~~~~~~
make[4]: *** [scripts/Makefile.build:266: drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.o] Error 1

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
index 9d17761721de..c7e55fe170bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
@@ -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))
-- 
2.25.1

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux