]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 21 Aug 2016 18:27:02 +0000 (20:27 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Aug 2016 17:48:05 +0000 (13:48 -0400)
if (a == NULL || a->b == NULL)
leads to a NULL pointer dereference if a == NULL.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

index b75fb123f370f73f9778cf279a6153f8c53d60f6..5ecef1732e20d252290b764b75c3ef21b14e443c 100644 (file)
@@ -1218,7 +1218,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);
        }