From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA4EEE7F153 for ; Wed, 27 Sep 2023 02:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235257AbjI0CuK (ORCPT ); Tue, 26 Sep 2023 22:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjI0CsJ (ORCPT ); Tue, 26 Sep 2023 22:48:09 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6D0F5FD1 for ; Tue, 26 Sep 2023 19:15:56 -0700 (PDT) X-UUID: 999c3971b0eb4d75a43b87d6a16689f0-20230927 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:1416603b-0ac3-4db7-bb60-931020906e72,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:1416603b-0ac3-4db7-bb60-931020906e72,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:112450bf-14cc-44ca-b657-2d2783296e72,B ulkID:23092621101442OWP2A1,BulkQuantity:3,Recheck:0,SF:24|17|19|44|64|38|8 17|102,TC:nil,Content:0|-5,EDM:-3,IP:-2,URL:0,File:nil,Bulk:40,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: 1,FCT|NGT X-CID-BAS: 1,FCT|NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 999c3971b0eb4d75a43b87d6a16689f0-20230927 X-User: liucong2@kylinos.cn Received: from [172.20.119.219] [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 128/128) with ESMTP id 817738456; Wed, 27 Sep 2023 10:15:42 +0800 Message-ID: <3b71215d-3ad5-e8c8-20eb-a48610403359@kylinos.cn> Date: Wed, 27 Sep 2023 10:15:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 From: Cong Liu Subject: Re: [PATCH 2/2] drm/amd/display: Fix null pointer dereference in error message To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Aurabindo Pillai , Tom Chung Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20230926055618.119195-1-liucong2@kylinos.cn> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > 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 >> --- >> 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; >> } >> >