[PATCH] drm/amdkfd: Fix the memory overrun

Felix Kuehling felix.kuehling at amd.com
Mon Nov 7 14:32:16 UTC 2022


Am 2022-11-07 um 02:08 schrieb Ma Jun:
> Fix the memory overrun issue caused by wrong array size.
>
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
> Reported-by: coverity-bot <keescook+coverity-bot at chromium.org>
> Addresses-Coverity-ID: 1527133 ("Memory - corruptions")
> Fixes: 6246000093863 ("drm/amdkfd: Fix the warning of array-index-out-of-bounds")

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index 7029e3bdff3e..6e81f50ad912 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> @@ -1111,7 +1111,7 @@ static int kfd_parse_subtype_cache(struct crat_subtype_cache *cache,
>   			props->cache_latency = cache->cache_latency;
>   
>   			memcpy(props->sibling_map, cache->sibling_map,
> -					sizeof(props->sibling_map));
> +					CRAT_SIBLINGMAP_SIZE);
>   
>   			/* set the sibling_map_size as 32 for CRAT from ACPI */
>   			props->sibling_map_size = CRAT_SIBLINGMAP_SIZE;


More information about the amd-gfx mailing list