linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: "David Airlie" <airlied@linux.ie>, "Rex Zhu" <Rex.Zhu@amd.com>,
	"Eric Huang" <JinHuiEric.Huang@amd.com>,
	"Jammy Zhou" <Jammy.Zhou@amd.com>,
	"Eric Yang" <eric.yang2@amd.com>,
	"Vitaly Prosyak" <vitaly.prosyak@amd.com>,
	"Nils Wallménius" <nils.wallmenius@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>
Subject: [PATCH 1/1] drm/amd/powerplay: avoid NULL dereference, cz_hwmgr.c
Date: Sun, 21 Aug 2016 20:27:02 +0200	[thread overview]
Message-ID: <1471804022-3486-1-git-send-email-xypron.glpk@gmx.de> (raw)

if (a == NULL || a->b == NULL)
leads to a NULL pointer dereference if a == NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 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);
 	}
-- 
2.1.4

                 reply	other threads:[~2016-08-21 18:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471804022-3486-1-git-send-email-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=Jammy.Zhou@amd.com \
    --cc=JinHuiEric.Huang@amd.com \
    --cc=Rex.Zhu@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric.yang2@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nils.wallmenius@gmail.com \
    --cc=vitaly.prosyak@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).