mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
366d480700
commit
409bbf1e3d
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue