From patchwork Sun Aug 21 18:27:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 9292765 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 E246A600CB for ; Mon, 22 Aug 2016 00:40:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5AC3287DE for ; Mon, 22 Aug 2016 00:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA90D287F4; Mon, 22 Aug 2016 00:40:08 +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 819A6287DE for ; Mon, 22 Aug 2016 00:40:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A40426E2A5; Mon, 22 Aug 2016 00:40:00 +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 890416E154 for ; Sun, 21 Aug 2016 18:27:18 +0000 (UTC) Received: from workstation4.fritz.box ([109.91.48.91]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MSHax-1biJjK2Ckd-00TYfC; Sun, 21 Aug 2016 20:27:09 +0200 From: Heinrich Schuchardt To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c Date: Sun, 21 Aug 2016 20:27:02 +0200 Message-Id: <1471804022-3486-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:ZBTSmACiS3HyHC83PA23NM9uXrH/JTWcfPg3099R4ZMZq8jiDFV Z4TgdlKEXLhYpXQaN5p2B7VSd7MzxTmHc2VoM+gKzKupiDzP7/iw4EukLf+aX6Gl9en/Eyu eJqe48v2ykbqBojGM1aC4yKiRb2tT+TH6KQ2LCL9U/8A4Uetmd061injM4/kiRS4hAFBZU7 xUJKANr+9ykOte0PGL0vg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Xe/bJMQNbSA=:P8deFaF1F6Se8ejEN6mWAO 1rYFAniv1eGNyYOnSZ7B1mQ3VlRHviOGcbgMYiAQOi2RKXUOaXnHLjQpH4wgiWZ4odAdQKNcR y4pNAnINGzmD35TXWzex40RCX4meC1cZHby3ARAakm8ZUrMLlZU4Nba1UQ/0VjSAWubMk+hVC DhBAnY4kjjUfIVdbF+04ZiimaApEd+HX52Aai7oALNImV4qRZ7rKZEvXEfh5aNf1sjq3HMVT5 FM9LhSkGY6btHHRsCVuUL/DCkHRlZ+u2lPkNggGDlFl+7roW3s+gfD0U3kxeWVPcqNrtrFKzB dbxEEbuY6D0nN+EL5rrJBAOFgJ4eRiHjpqw6g+tIWy+YYo065rxAcVOVPMzXonvxfRsJYoEw3 Rv1+XUAVcK1Mtet1OcarJVg/O3U0gskeofkC+8wHRJYQafzyzpP+I1AZ8rdJPlqRCGPhbRXh4 uiNUBffsZuoocGKvFTVAttoEJ4kmONOwrw7o0V9GJAe8nrXTiZJ2TyLq380iDqsmh+jd/U3pt /MhR5Sqw7o9ZHomM+SQtz3eK1Kh8Ub8cfRTzFrXuAHPdLZOEaMd29KTQ1WreawM8Jk+4WIRo+ TYHYI0HifRflSGgdhe8cizn9DgXjvIF8KGsqUVz2DH5r3FlJHRK3469izFJerfTSN3g6PU7D2 3KvLYdLQLbwrHQFGLzlRtqL+KP0JrpGwu0sGW4kytM6clGUKqqwfed2RIaPPLghQcmdL9SVuV nIz3YhmarQHm+fxHX8Do7B0BxCmYoc5i1K/C7uQPICiKE9VgA9H1UEujlro= X-Mailman-Approved-At: Mon, 22 Aug 2016 00:39:59 +0000 Cc: Eric Yang , Jammy Zhou , Heinrich Schuchardt , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Vitaly Prosyak , Eric Huang , Rex Zhu , =?UTF-8?q?Nils=20Wallm=C3=A9nius?= 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/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); }