Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467197 > unrolled thread

[PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c

Started byHeinrich Schuchardt <xypron.glpk@gmx.de>
First post2016-08-21 20:30 +0200
Last post2016-08-21 20:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-08-21 20:30 +0200

#1467197 — [PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c

FromHeinrich Schuchardt <xypron.glpk@gmx.de>
Date2016-08-21 20:30 +0200
Subject[PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c
Message-ID<s8FFo-3OO-11@gated-at.bofh.it>
if (a == NULL || a->b == NULL)
leads to a NULL pointer dereference if a == NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index 8cc0df9..5e2d4cf 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -1246,7 +1246,7 @@ static int cz_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 static int cz_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
 {
-	if (hwmgr != NULL || hwmgr->backend != NULL) {
+	if (hwmgr != NULL && hwmgr->backend != NULL) {
 		kfree(hwmgr->backend);
 		kfree(hwmgr);
 	}
-- 
2.1.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web