Message ID | 20230926055618.119195-1-liucong2@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1698527vqu; Mon, 25 Sep 2023 23:05:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSXyF/fEGI4YJc06oN75qFreMVRaWB3eRQs1eU4B1YGoCQNbySDcsc3C2BzYx8Xfsz8XHD X-Received: by 2002:a05:6a20:564d:b0:15d:c274:2eb1 with SMTP id is13-20020a056a20564d00b0015dc2742eb1mr6003489pzc.10.1695708304189; Mon, 25 Sep 2023 23:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695708304; cv=none; d=google.com; s=arc-20160816; b=vCc69HXLEyrunSLvJ/rHiT/e6nJREFnM+RDGpOIvumOl1Tz9MzHSrl7zRQLaiXh+OV y/pzNpcIzkGz2UWASQvjtWr14afsXSfK3fSzA315HpBJPso0RvdUF41a+D8FdHniDOGA rtMW+cTj2V02Rv9ivZ2Hk7XMsUO1o8/5SvSvqXDN1ZiKL2zt2W5fh7L6xRHhARIZtaQq 4p9oBsBcT8KVpWduV5FH8oJPjN9OkEuXEF6NMKtr1dkwoZ1XHZ+alQzXaGQqunibYHPD k+9RYxHwm8uIhKvsABnsM3IjICvRlcno9UodsoWKrAgpo63wjZpZK4n+BJjs5u7dHHPp LS2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xaLN3bUjJ2TfmzLNkr2YFYQFc55g8TAzz3ecOcckGQ4=; fh=Y4KPzTfXNHevA2GvFfn4pFCqxHZQYb62OXCfgRBC4fI=; b=GHp4r6hFwAr+Yb9kNfeKbX1cJ9lpNoWfzCfICjxNvdHFEO8pcwD3N9FNiauTBkBtpY udFea/SRoyOrPS3b2/oxWc3gVYv5MFuD0hK+sRGEhjuKYcTL/C3H+9e3TU2XF24eoEft Hst20Q2VUu2NvFGTcwNJ7UTyd7usG/0Jw2ApQG6x01PMo051sLXPzfN84ZFXveRkhPUl ku5c9K/JZ9qmWWjqfQpI9gdROR4cGB7y0TP6qIB73xNq5Og//7TpbD9m38Z1QcXKCf40 +2K3K/+og17AOSmEtu2cdlEqnBh6NELMKHJaUyJb/LRBRoY110ul5tf+LskUIjzLfXY/ 6qAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cn12-20020a056a020a8c00b00564a5b8937asi11295455pgb.341.2023.09.25.23.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 23:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E015280A1E31; Mon, 25 Sep 2023 22:56:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbjIZF4u (ORCPT <rfc822;ruipengqi7@gmail.com> + 26 others); Tue, 26 Sep 2023 01:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233689AbjIZF4r (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 26 Sep 2023 01:56:47 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE1810A for <linux-kernel@vger.kernel.org>; Mon, 25 Sep 2023 22:56:40 -0700 (PDT) X-UUID: 48b130231b3f480fa2b389aa17cc4c13-20230926 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:274d52f7-406d-450b-9626-9226bea3d323,IP:5,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-INFO: VERSION:1.1.31,REQID:274d52f7-406d-450b-9626-9226bea3d323,IP:5,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-10 X-CID-META: VersionHash:0ad78a4,CLOUDID:710a47bf-14cc-44ca-b657-2d2783296e72,B ulkID:23092613562995M22TSX,BulkQuantity:0,Recheck:0,SF:19|44|38|24|17|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 48b130231b3f480fa2b389aa17cc4c13-20230926 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from <liucong2@kylinos.cn>) (Generic MTA) with ESMTP id 827163063; Tue, 26 Sep 2023 13:56:29 +0800 From: Cong Liu <liucong2@kylinos.cn> To: Harry Wentland <harry.wentland@amd.com>, Leo Li <sunpeng.li@amd.com>, Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>, Alex Deucher <alexander.deucher@amd.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, "Pan, Xinhui" <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Aurabindo Pillai <aurabindo.pillai@amd.com>, Tom Chung <chiahsuan.chung@amd.com> Cc: Cong Liu <liucong2@kylinos.cn>, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message Date: Tue, 26 Sep 2023 13:56:17 +0800 Message-Id: <20230926055618.119195-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 22:56:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778079030688115886 X-GMAIL-MSGID: 1778079030688115886 |
Series |
[1/2] drm/amd/pm: Fix warn: missing error code in smu_v13_0_0_check_ecc_table_support()
|
|
Commit Message
Cong Liu
Sept. 26, 2023, 5:56 a.m. UTC
This patch fixes a null pointer dereference in the error message that is
printed when the Display Core (DC) fails to initialize. The original
message includes the DC version number, which is undefined if the DC is
not initialized.
Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 2023-09-26 01:56, Cong Liu wrote: > This patch fixes a null pointer dereference in the error message that is > printed when the Display Core (DC) fails to initialize. The original > message includes the DC version number, which is undefined if the DC is > not initialized. > > Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") > Signed-off-by: Cong Liu <liucong2@kylinos.cn> > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index 8e98dda1e084..bf52a909f558 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) > DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, > dce_version_to_string(adev->dm.dc->ctx->dce_version)); > } else { > - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, > - dce_version_to_string(adev->dm.dc->ctx->dce_version)); > + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); There is value in printing the version number. Let's not remove it. Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx. Harry > goto error; > } >
> > > On 2023-09-26 01:56, Cong Liu wrote: >> This patch fixes a null pointer dereference in the error message that is >> printed when the Display Core (DC) fails to initialize. The original >> message includes the DC version number, which is undefined if the DC is >> not initialized. >> >> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") >> Signed-off-by: Cong Liu <liucong2@kylinos.cn> >> --- >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> index 8e98dda1e084..bf52a909f558 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) >> DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, >> dce_version_to_string(adev->dm.dc->ctx->dce_version)); >> } else { >> - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, >> - dce_version_to_string(adev->dm.dc->ctx->dce_version)); >> + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); > > There is value in printing the version number. Let's not remove it. > > Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx. Hi Harry I don't understand what you mean. Are you saying that I need to add a NULL check in the if statement (i.e. if(adev->dm.dc && adev->dm.dc->ctx)), because adev->dm.dc is NULL in the else statement and there is no way to print adev->dm.dc->ctx->dce_version. Regards Cong > > Harry > >> goto error; >> } >> >
Am 26.09.23 um 15:09 schrieb Harry Wentland: > > On 2023-09-26 01:56, Cong Liu wrote: >> This patch fixes a null pointer dereference in the error message that is >> printed when the Display Core (DC) fails to initialize. The original >> message includes the DC version number, which is undefined if the DC is >> not initialized. >> >> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") >> Signed-off-by: Cong Liu <liucong2@kylinos.cn> >> --- >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> index 8e98dda1e084..bf52a909f558 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) >> DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, >> dce_version_to_string(adev->dm.dc->ctx->dce_version)); >> } else { >> - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, >> - dce_version_to_string(adev->dm.dc->ctx->dce_version)); >> + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); > There is value in printing the version number. Let's not remove it. > > Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx. But as far as I understand it adev->dm.dc->ctx will always be NULL in this case. Regards, Christian. > > Harry > >> goto error; >> } >>
On 2023-09-27 01:23, Christian König wrote: > Am 26.09.23 um 15:09 schrieb Harry Wentland: >> >> On 2023-09-26 01:56, Cong Liu wrote: >>> This patch fixes a null pointer dereference in the error message that is >>> printed when the Display Core (DC) fails to initialize. The original >>> message includes the DC version number, which is undefined if the DC is >>> not initialized. >>> >>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") >>> Signed-off-by: Cong Liu <liucong2@kylinos.cn> >>> --- >>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- >>> 1 file changed, 1 insertion(+), 2 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> index 8e98dda1e084..bf52a909f558 100644 >>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) >>> DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, >>> dce_version_to_string(adev->dm.dc->ctx->dce_version)); >>> } else { >>> - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, >>> - dce_version_to_string(adev->dm.dc->ctx->dce_version)); >>> + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); >> There is value in printing the version number. Let's not remove it. >> >> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx. > > But as far as I understand it adev->dm.dc->ctx will always be NULL in this case. > Thanks, Christian. We're in the else of the NULL check for adev-dm.dc, so obviously we can't get the version. Silly me. Your patch is Reviewed-by: Harry Wentland <harry.wentland@amd.com> Harry > Regards, > Christian. > >> >> Harry >> >>> goto error; >>> } >>> >
On 2023-09-27 10:07, Harry Wentland wrote: > > > On 2023-09-27 01:23, Christian König wrote: >> Am 26.09.23 um 15:09 schrieb Harry Wentland: >>> >>> On 2023-09-26 01:56, Cong Liu wrote: >>>> This patch fixes a null pointer dereference in the error message that is >>>> printed when the Display Core (DC) fails to initialize. The original >>>> message includes the DC version number, which is undefined if the DC is >>>> not initialized. >>>> >>>> Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC") >>>> Signed-off-by: Cong Liu <liucong2@kylinos.cn> >>>> --- >>>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>>> index 8e98dda1e084..bf52a909f558 100644 >>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>>> @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) >>>> DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, >>>> dce_version_to_string(adev->dm.dc->ctx->dce_version)); >>>> } else { >>>> - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, >>>> - dce_version_to_string(adev->dm.dc->ctx->dce_version)); >>>> + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); >>> There is value in printing the version number. Let's not remove it. >>> >>> Instead you can probably fix it by doing a NULL check on adev->dm.dc->ctx. >> >> But as far as I understand it adev->dm.dc->ctx will always be NULL in this case. >> > > Thanks, Christian. We're in the else of the NULL check for > adev-dm.dc, so obviously we can't get the version. Silly me. > > Your patch is > Reviewed-by: Harry Wentland <harry.wentland@amd.com> > Patch is merged. Harry > Harry > >> Regards, >> Christian. >> >>> >>> Harry >>> >>>> goto error; >>>> } >>>> >> >
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 8e98dda1e084..bf52a909f558 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1703,8 +1703,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) DRM_INFO("Display Core v%s initialized on %s\n", DC_VER, dce_version_to_string(adev->dm.dc->ctx->dce_version)); } else { - DRM_INFO("Display Core v%s failed to initialize on %s\n", DC_VER, - dce_version_to_string(adev->dm.dc->ctx->dce_version)); + DRM_INFO("Display Core failed to initialize with v%s!\n", DC_VER); goto error; }