drm/amd/powerplay: avoid NULL pointer dereference
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 21 Aug 2016 18:21:27 +0000 (20:21 +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/amd_powerplay.c

index 12d3333b9d12ca9d9310b36e09d9efb11bb606b2..2de34a5a85c2f6e502ebbccc446d9a2f970eb156 100644 (file)
@@ -163,12 +163,12 @@ static int pp_hw_fini(void *handle)
        pp_handle = (struct pp_instance *)handle;
        eventmgr = pp_handle->eventmgr;
 
-       if (eventmgr != NULL || eventmgr->pp_eventmgr_fini != NULL)
+       if (eventmgr != NULL && eventmgr->pp_eventmgr_fini != NULL)
                eventmgr->pp_eventmgr_fini(eventmgr);
 
        smumgr = pp_handle->smu_mgr;
 
-       if (smumgr != NULL || smumgr->smumgr_funcs != NULL ||
+       if (smumgr != NULL && smumgr->smumgr_funcs != NULL &&
                smumgr->smumgr_funcs->smu_fini != NULL)
                smumgr->smumgr_funcs->smu_fini(smumgr);