lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 17 Jan 2017 16:25:00 +0000
From:   Liviu Dudau <Liviu.Dudau@....com>
To:     Brian Starkey <brian.starkey@....com>
Cc:     Mali DP Maintainers <malidp@...s.arm.com>,
        David Airlie <airlied@...ux.ie>,
        DRI devel <dri-devel@...ts.freedesktop.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Shailendra Verma <shailendra.v@...sung.com>,
        Shailendra Verma <Shailendra.v@...sung.com>
Subject: [PATCH 1/8] drm/arm/malidp: Fix possible dereference of NULL

From: Shailendra Verma <shailendra.v@...sung.com>

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: Shailendra Verma <Shailendra.v@...sung.com>
[cleaned up the code and re-formatted the commit message]
Signed-off-by: Liviu Dudau <Liviu.Dudau@....com>
---
 drivers/gpu/drm/arm/malidp_planes.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index eff2fe47e26a..d1cc15724dc3 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -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) {
-		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;
-	}
+	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;
 }
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ