[Intel-gfx] [PATCH] drm: Check if the allocation has succeeded before dereferencing newmode
Alex Deucher
alexdeucher at gmail.com
Tue Mar 4 16:06:52 CET 2014
On Mon, Mar 3, 2014 at 6:59 PM, Damien Lespiau <damien.lespiau at intel.com> wrote:
> We allocate memory in drm_display_mode_from_vic_index() and use it
> without checking the pointer is valid. Fix that.
>
> Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/drm_edid.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index f8d8a1d..f3cde90 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2580,6 +2580,9 @@ drm_display_mode_from_vic_index(struct drm_connector *connector,
> return NULL;
>
> newmode = drm_mode_duplicate(dev, &edid_cea_modes[cea_mode]);
> + if (!newmode)
> + return NULL;
> +
> newmode->vrefresh = 0;
>
> return newmode;
> --
> 1.8.3.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the Intel-gfx
mailing list