Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3120080ybc; Mon, 18 Nov 2019 09:49:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzWJsoZ2Wyyr24r5dlfhgNIjHvCcHSzy9nOnPqnC8RaPADxJ9UcpqLxn/dB9phyms5o97fL X-Received: by 2002:a17:906:2505:: with SMTP id i5mr7533387ejb.18.1574099376635; Mon, 18 Nov 2019 09:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574099376; cv=none; d=google.com; s=arc-20160816; b=sCnixJie+q5X3MGpItWJR1KUIIlDqsKv63pawC344ywXorXMhYiA1lp+eVsQ7NNRkK IowRAbhngWkIvMjoBEpYd6LAq1yrrDPytSRM0GggR9w/zh/6xdeUAPWBeuffft51ijHR DWjt6F5IEdRiGs6Hl7MaQcP4bnFf+qcGxpPGMKbfRFvCB/m8L8M1ibnL5uyhALvbfkP3 GjQWoMucFSA0WJ3yMx0HTv3DRSudneTsLldvDJ2dylq4rpP2mqrxqUujhWKekAxGSQ93 bn1FKUp/4pBWy6enUDt2i8QQ8TeOXWLT7MnVjN7dt9YQTmoQ3kO7ox4BUuSXYRrc+/EX wbAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=piNHro+ZEjxTlVQYbgYFct0MWJy6Nfv3mhGBZxaqWEI=; b=aaXlgPa1ZpXM/fWlO1JxIPurDYCX8HFfex/WJGQ0e9c+3o0kXt5YdVXBPABKJg//Bt Am+3tP/+GfigDf5+9OBT8Khk39OAMFNtFptQM9zUdT8fH7Tlt90LdaF5jqnGE3RyxFU2 MGTES++zhNrZ6S/ulPnNewyYZZhqA6wGVqSv+JDyOsTrZ/byq8ZO/pt5bEGaB1Jdj8Fz 2s3bo1SrJGFg/Gdtk5r4jcOO7W1Dz7PsywoKvPEbHP0f0aDOEd7FPjQEOR9hHFMpd0Tb A1zsyKjReWsowcHItQouS3pgiHL8cWQNe6oRrNZDtqsQSF/PCJyqcTAiO9ucwx45vXoQ MDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UcScLZd4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si12169568ejr.262.2019.11.18.09.49.13; Mon, 18 Nov 2019 09:49:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UcScLZd4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbfKRRsE (ORCPT + 99 others); Mon, 18 Nov 2019 12:48:04 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42733 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbfKRRsE (ORCPT ); Mon, 18 Nov 2019 12:48:04 -0500 Received: by mail-wr1-f68.google.com with SMTP id a15so20579853wrf.9; Mon, 18 Nov 2019 09:48:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=piNHro+ZEjxTlVQYbgYFct0MWJy6Nfv3mhGBZxaqWEI=; b=UcScLZd47Ox+WvIdRLwBXlvs7qK537HzRtbKDchwlW+qVieV2yoxduZiS/8bKA7ZZC L1uY3ELur64yoob3gNfgGBqlVgbUWKVfrXWMTw1kE95SPQxB6i77lBTuV5OuoYL8YM5v HGQsUHoVlMgfW/aM5HqdZWzChr3zx39uMDlrcRTqkHK/h7a+OWKQE6I2QKz+acfPqyDB WTcv7aBh31zUuBi9K6azzO2WBylVe++dkigF4YDD8EuQ37ZPiF/KWpbyqi+EA0j+gxdN bkkX1tMAeHRuRHVJhTAweZFBBDuz/9zk+KckxOUXrng7mCnpS2IuJNz5IcOGR6Djz1Qp X5fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=piNHro+ZEjxTlVQYbgYFct0MWJy6Nfv3mhGBZxaqWEI=; b=D16bMPRTg9vV+liYwXSorHlQW13m8pfZOOkcNUFgMHTxzeX3lgZreyGU3BLJWK33OL SJgUc1X0M4PE1ToK9oR5MUUF3zxNtVIEzMXCrCQt3+u3TxJntQn2YGaw8DQH4E7OMnQv fBEt+IiJbBc50ij4FNswfn91T4ofbfrRIhW+XtTmmuDdSym3msnsn3r/1uyUkDuQsdUv 51IHuoVKDGHDiZRyIdhqlyMiw0ONC/CbNcGr4OrXcrL2szdWZltRnCLzjVjj+5Dd0oca Ks5eEAsn/oKth1SvlKptwxQwhf3LqrnNRXbSmfJzCfttcMwy0Oa4rcvz85qW65YZqanG awDQ== X-Gm-Message-State: APjAAAVtGn6pcUPW/P3HT5ebBwfU9xEh7Kbd6x3Qfs1J4/N4lSIT1FBV 6HqI1M4bJSmD8UDNzr6KvQrtfRL5edq75Y58a9I= X-Received: by 2002:adf:9d87:: with SMTP id p7mr31061751wre.11.1574099281432; Mon, 18 Nov 2019 09:48:01 -0800 (PST) MIME-Version: 1.0 References: <20191115094754.40920-1-colin.king@canonical.com> In-Reply-To: From: Alex Deucher Date: Mon, 18 Nov 2019 12:47:49 -0500 Message-ID: Subject: Re: [PATCH][next] drm/amdgpu/powerplay: fix dereference before null check of pointer hwmgr To: "Quan, Evan" Cc: Colin King , Rex Zhu , "Deucher, Alexander" , "Koenig, Christian" , "Zhou, David(ChunMing)" , David Airlie , Daniel Vetter , "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applied. Thanks! Alex On Mon, Nov 18, 2019 at 1:56 AM Quan, Evan wrote: > > Reviewed-by: Evan Quan > > -----Original Message----- > From: Colin King > Sent: Friday, November 15, 2019 5:48 PM > To: Rex Zhu ; Quan, Evan ; Deucher, A= lexander ; Koenig, Christian ; Zhou, David(ChunMing) ; David Airlie ; Daniel Vetter ; amd-gfx@lists.freedesktop.org;= dri-devel@lists.freedesktop.org > Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [PATCH][next] drm/amdgpu/powerplay: fix dereference before null = check of pointer hwmgr > > From: Colin Ian King > > The assignment of adev dereferences pointer hwmgr before hwmgr is null ch= ecked, hence there is a potential null pointer deference issue. Fix this by= assigning adev after the null check. > > Addresses-Coverity: ("Dereference before null check") > Fixes: 0896d2f7ba4d ("drm/amdgpu/powerplay: properly set PP_GFXOFF_MASK") > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/dr= m/amd/powerplay/hwmgr/hwmgr.c > index 443625c83ec9..d2909c91d65b 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c > @@ -81,7 +81,7 @@ static void hwmgr_init_workload_prority(struct pp_hwmgr= *hwmgr) > > int hwmgr_early_init(struct pp_hwmgr *hwmgr) { > - struct amdgpu_device *adev =3D hwmgr->adev; > + struct amdgpu_device *adev; > > if (!hwmgr) > return -EINVAL; > @@ -96,6 +96,8 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr) > hwmgr_init_workload_prority(hwmgr); > hwmgr->gfxoff_state_changed_by_workload =3D false; > > + adev =3D hwmgr->adev; > + > switch (hwmgr->chip_family) { > case AMDGPU_FAMILY_CI: > adev->pm.pp_feature &=3D ~PP_GFXOFF_MASK; > -- > 2.20.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel