[PATCH] drm/exynos: Fix potential NULL pointer dereference

Inki Dae inki.dae at samsung.com
Thu Sep 20 23:37:44 PDT 2012


Applied.

Thanks,
Inki Dae

2012/9/18 Sachin Kamat <sachin.kamat at linaro.org>:
> drm_mode_create() returns NULL if it fails to create
> a new display mode. Check the value returned to avoid NULL
> pointer deferencing later.
>
> Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_connector.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
> index 9dce3b9..485e984 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
> @@ -149,8 +149,12 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
>                 count = drm_add_edid_modes(connector, edid);
>                 kfree(edid);
>         } else {
> -               struct drm_display_mode *mode = drm_mode_create(connector->dev);
>                 struct exynos_drm_panel_info *panel;
> +               struct drm_display_mode *mode = drm_mode_create(connector->dev);
> +               if (!mode) {
> +                       DRM_ERROR("failed to create a new display mode.\n");
> +                       return 0;
> +               }
>
>                 if (display_ops->get_panel)
>                         panel = display_ops->get_panel(manager->dev);
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list