Message ID | 1347963690-4998-1-git-send-email-sachin.kamat@linaro.org |
---|---|
State | Accepted |
Headers | show |
Applied. Thanks, Inki Dae 2012/9/18 Sachin Kamat <sachin.kamat@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@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@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
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);
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@linaro.org> --- drivers/gpu/drm/exynos/exynos_drm_connector.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)