From: Heinrich Schuchardt Date: Sun, 21 Aug 2016 18:27:02 +0000 (+0200) Subject: drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bb1800caf773eb8d819e0964c7efd96efe435fa1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c if (a == NULL || a->b == NULL) leads to a NULL pointer dereference if a == NULL. Reviewed-by: Christian König Signed-off-by: Heinrich Schuchardt Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c index b75fb123f370..5ecef1732e20 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c @@ -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); }