From patchwork Sun Aug 21 18:21:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 9292769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 00BBD600CB for ; Mon, 22 Aug 2016 00:40:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E71FC287DE for ; Mon, 22 Aug 2016 00:40:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBB0C287F4; Mon, 22 Aug 2016 00:40:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A9068287DE for ; Mon, 22 Aug 2016 00:40:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31F146E2A6; Mon, 22 Aug 2016 00:40:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id D372C6E154 for ; Sun, 21 Aug 2016 18:21:41 +0000 (UTC) Received: from workstation4.fritz.box ([109.91.48.91]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LfYqz-1amU6B29RR-00p3dt; Sun, 21 Aug 2016 20:21:34 +0200 From: Heinrich Schuchardt To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 1/1] drm/amd/powerplay: avoid NULL pointer dereference Date: Sun, 21 Aug 2016 20:21:27 +0200 Message-Id: <1471803687-3371-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:BPzRM4a83l8v6Tnv5VN1GnZyuIM+SmpyT/sQiDkdwfuVgl/u9tj gkOZLeMjILk+b29MnSf1X5MfbzU1DWbui85BSGfSvCc12cHtxIpOBxu5BWW652DHvZh58jw +h5Ov/G8QtXtzJAL0fTL64qKAlqLC1u5SOta7JXtvrAU5XiWTHBBcaLw+CJW5IhHZVzmplX cGMkpoT9iaMaOg++njWow== X-UI-Out-Filterresults: notjunk:1; V01:K0:MFschZdsaxM=:UxFO9k2uf5cfYnsG0HVyGb HAfmNHUR7jghXCbnCA6C4wr+h6Wm1Mp9rf0X71MjnspEBzb+iOFY4QBdHKV9mZVGt/jFcZhBN 9pPI7IjeMjjLpGUHfrFQFIlYyahNYeuJgH2wHETvE62rgc4aHTrgDbjcy1CQylr4WhNITGier apQUFK2mZb3oV4qPSXoi5xSvSJc/UKfRGQT60LIu0GGB0eNJcj9noVAvbqF7UF76GqUeJA/IR JCdHTqjY2IMjRHP6EWhtsYANxPRoGJo0ACWv99EWP0SfuN4HnH7WHdCeDvPjXlxxGCmNDq6j3 sTz2/hqBi8vDKjfMqK7t7JJKLbBIs0uip8mWvKgmaj++GroYPles7wo56zxuxGi4740xg4fco TXZ2WLz/tUe5BVes23S9iITKjzlwy8NXId6f4LdCaike1C5G/fr1w62uacKOc07YfLAdtXVCZ hCSxrc1iPbV0wUQQxX8Ia+fq8RKw+dtzzRCEkZ7+KqEH/bchU6ZQWSCWoJH5r57BDvjQ8u21t 4FtY2jooE/5V87DRHwbbkDCKPyl2M2/hfwILRUKnvB/8oxPqEeIEE35QYvRO1YR7sLaTqqbhB ht0C2UrsaGenSRqyPJ/Lr7Gtin+BsZsG0MG9KdaeLYkaWdPQ1nxdhbjpYTvKP2JTewceUOafe zyS/ogDLH1qUUib2fyEnvbya9C1tgVGCNRNGHNK7k1Oc/KVm3FE0P4B4NqsF9pq0Jgq6j2sMb p6TR6ScaVnk0ItIgDb2ZAyAZKir9sBddQcPqJtL8uyTJaZ52kGqA3JCBXwA= X-Mailman-Approved-At: Mon, 22 Aug 2016 00:39:59 +0000 Cc: Jammy Zhou , Heinrich Schuchardt , David Rokhvarg , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Huang Rui , Vitaly Prosyak , Eric Huang , Rex Zhu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP if (a == NULL || a->b == NULL) leads to a NULL pointer dereference if a == NULL. Signed-off-by: Heinrich Schuchardt --- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index abbb658..456a339 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -162,12 +162,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);