[PATCH 1/2] drm/amdgpu: Fix null ptr when calling query_ras_error_count

Zhou1, Tao Tao.Zhou1 at amd.com
Wed Aug 14 02:24:00 UTC 2019


Hi Andrey:

I'm also working on ras error address saving based on your eeprom patches, and the implementation is different from you.
I'll send out my patches this week and we can discuss it.

Regards,
Tao

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Andrey Grodzovsky
> Sent: 2019年8月14日 1:51
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Grodzovsky,
> Andrey <Andrey.Grodzovsky at amd.com>; Pan, Xinhui
> <Xinhui.Pan at amd.com>; Zhang, Hawking <Hawking.Zhang at amd.com>
> Subject: [PATCH 1/2] drm/amdgpu: Fix null ptr when calling
> query_ras_error_count
> 
> ras_err_data.err_addr was never allocated
> 
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 50c13b0..d9fb860 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1011,6 +1011,21 @@ static void amdgpu_ras_interrupt_handler(struct
> ras_manager *obj)
>  	int ret;
>  	struct ras_err_data err_data = {0, 0, 0, NULL};
> 
> +	/* Allocate enough to serve max  number of requests*/
> +	int err_addr_size = data->ring_size / data->aligned_element_size *
> +			   obj->adev->umc.umc_inst_num *
> +			   obj->adev->umc.channel_inst_num;
> +
> +	err_data.err_addr = kcalloc(err_addr_size,
> +				    sizeof(*err_data.err_addr),
> +				    GFP_KERNEL);
> +
> +	if (!err_data.err_addr) {
> +		DRM_ERROR("Not enough memory!");
> +		return;
> +	}
> +
> +
>  	while (data->rptr != data->wptr) {
>  		rmb();
>  		memcpy(&entry, &data->ring[data->rptr], @@ -1039,6
> +1054,8 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager
> *obj)
>  			}
>  		}
>  	}
> +
> +	 kfree(err_data.err_addr);
>  }
> 
>  static void amdgpu_ras_interrupt_process_handler(struct work_struct
> *work)
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list