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

Commit 2419672f authored by Dan Carpenter's avatar Dan Carpenter Committed by Tomi Valkeinen
Browse files

drm/omap: Potential NULL deref in omap_crtc_duplicate_state()



If the kmalloc() fails then we dereference "state" when we set
"state->zpos".

Fixes: 3dfeb631 ("drm/omap: Rework the rotation-on-crtc hack")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4161f200
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -589,7 +589,9 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc)
	current_state = to_omap_crtc_state(crtc->state);

	state = kmalloc(sizeof(*state), GFP_KERNEL);
	if (state)
	if (!state)
		return NULL;

	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);

	state->zpos = current_state->zpos;