[PATCH] drm/amd/display: fix NULL pointer dereference.

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

 



> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of
> Rex Zhu
> Sent: Wednesday, April 05, 2017 15:55
> To: amd-gfx at lists.freedesktop.org
> Cc: Zhu, Rex
> Subject: [PATCH] drm/amd/display: fix NULL pointer dereference.
> 
> on vega10, driver can run into a NULL-pointer dereference.
> 
> Change-Id: I8e2de5343f804d6e736f620ff6d3d6e6488fb970
> Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 62be159..8f5951f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1095,7 +1095,8 @@ int amdgpu_dm_initialize_drm_device(struct
> amdgpu_device *adev)
>  			DRM_ERROR("KMS: Failed to allocate surface\n");
>  			goto fail_free_planes;
>  		}
> -		mode_info->planes[i]->plane_type = mode_info->plane_type[i];
> +		if (mode_info->plane_type != NULL)

We can simplify it like:
if (mode_info->plane_type)

With that fix,   
Reviewed-by: Junwei Zhang <Jerry.Zhang at amd.com>

> +			mode_info->planes[i]->plane_type = mode_info-
> >plane_type[i];
>  		if (amdgpu_dm_plane_init(dm, mode_info->planes[i], 1)) {
>  			DRM_ERROR("KMS: Failed to initialize plane\n");
>  			goto fail_free_planes;
> --
> 1.9.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> 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