lkml.org 
[lkml]   [2016]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Gpu: drm: arm: - Fix possible dereference of NULL
Date
From: "Shailendra Verma" <shailendra.v@samsung.com>

There is possible dereference of NULL pointer if kmalloc fails.
So return NULL if kmalloc fails.

Signed-off-by: Shailendra Verma <Shailendra.v@samsung.com>
---
drivers/gpu/drm/arm/malidp_planes.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 82c193e..f769398 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -54,6 +54,9 @@ struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
return NULL;

state = kmalloc(sizeof(*state), GFP_KERNEL);
+ if (!state)
+ return NULL;
+
if (state) {
m_state = to_malidp_plane_state(plane->state);
__drm_atomic_helper_plane_duplicate_state(plane, &state->base);
--
1.7.9.5
\
 
 \ /
  Last update: 2016-11-11 09:49    [W:0.055 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site