Commit 94d8b9b7 authored by Shailendra Verma's avatar Shailendra Verma Committed by Liviu Dudau

drm/arm/malidp: Fix possible dereference of NULL

There is possible deference of NULL pointer on return of
malidp_duplicate_plane_state() if kmalloc fails. Check the
returned kmalloc pointer before continuing.
Signed-off-by: default avatarShailendra Verma <Shailendra.v@samsung.com>
[cleaned up the code and re-formatted the commit message]
Signed-off-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
parent f0493e65
......@@ -67,13 +67,14 @@ drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
return NULL;
state = kmalloc(sizeof(*state), GFP_KERNEL);
if (state) {
if (!state)
return NULL;
m_state = to_malidp_plane_state(plane->state);
__drm_atomic_helper_plane_duplicate_state(plane, &state->base);
state->rotmem_size = m_state->rotmem_size;
state->format = m_state->format;
state->n_planes = m_state->n_planes;
}
return &state->base;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment