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

Russell, Kent Kent.Russell at amd.com
Tue Apr 7 20:29:27 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Thanks Alex

Reviewed-By: Kent Russell <kent.russell at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Tuesday, April 7, 2020 10:55 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH] drm/amdgpu/eeprom: fix possible read overflow in memcpy
> 
> 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 at amd.com>
> ---
>  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 at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fr
> eedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&data=02%7C01%7Ckent.russell%40amd.com%7Cac36574b1634468f2
> 61a08d7db039cb0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6
> 37218680938415164&sdata=uaxSwz129HVKb1A3rG7yxzobsiQANnr6eWT
> IaxVijYM%3D&reserved=0


More information about the amd-gfx mailing list