[PATCH -next] drm/exynos: fix a potential error pointer dereference
Inki Dae
daeinki at gmail.com
Mon Aug 28 23:27:46 UTC 2023
2023년 8월 12일 (토) 오후 4:17, Xiang Yang <xiangyang at huaweicloud.com>님이 작성:
> From: Xiang Yang <xiangyang3 at huawei.com>
>
> Smatch reports the warning below:
> drivers/gpu/drm/exynos/exynos_hdmi.c:1864 hdmi_bind()
> error: 'crtc' dereferencing possible ERR_PTR()
>
> The return value of exynos_drm_crtc_get_by_type maybe ERR_PTR(-ENODEV),
> which can not be used directly. Fix this by checking the return value
> before using it.
>
Applied.
Thanks,
Inki Dae
>
> Signed-off-by: Xiang Yang <xiangyang3 at huawei.com>
> ---
> drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index f3aaa4ea3e68..dd9903eab563 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -1861,6 +1861,8 @@ static int hdmi_bind(struct device *dev, struct
> device *master, void *data)
> return ret;
>
> crtc = exynos_drm_crtc_get_by_type(drm_dev,
> EXYNOS_DISPLAY_TYPE_HDMI);
> + if (IS_ERR(crtc))
> + return PTR_ERR(crtc);
> crtc->pipe_clk = &hdata->phy_clk;
>
> ret = hdmi_create_connector(encoder);
> --
> 2.34.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230829/91e67f99/attachment.htm>
More information about the dri-devel
mailing list