Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 409bbf1e authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter
Browse files

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: default avatarDamien Lespiau <damien.lespiau@intel.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 366d4807
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;