Skip to content

Commit

Permalink
drm: Check if the allocation has succeeded before dereferencing newmode
Browse files Browse the repository at this point in the history
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@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Damien Lespiau authored and Daniel Vetter committed Mar 17, 2014
1 parent 366d480 commit 409bbf1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/drm_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 409bbf1

Please sign in to comment.