summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-03-04 00:59:07 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-17 11:23:07 +0100
commit409bbf1e3da29aaf57b520e29f904db9c7c2475e (patch)
tree03c20d00e2f73e69d798a44720e746b104bb3c39 /drivers/gpu/drm/drm_edid.c
parentdrm/fb-helper: Use drm_fb_helper_restore_fbdev_mode() in drm_fb_helper_set_par() (diff)
downloadlinux-409bbf1e3da29aaf57b520e29f904db9c7c2475e.tar.xz
linux-409bbf1e3da29aaf57b520e29f904db9c7c2475e.zip
drm: Check if the allocation has succeeded before dereferencing newmode
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>
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index f8d8a1de9573..f3cde90c1d98 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;