From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 27E772095E538 for ; Mon, 25 Sep 2017 21:15:17 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 25 Sep 2017 21:18:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,439,1500966000"; d="scan'208";a="132319523" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 25 Sep 2017 21:18:29 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 21:18:29 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 21:18:29 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Tue, 26 Sep 2017 12:18:27 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Shao, Ming" Thread-Topic: [edk2] [Patch] UefiCpuPkg/CpuCommonFeaturesLib: Add check for input parameter. Thread-Index: AQHTNnHqT6LqzylRmEexoG+hInZtAqLGj9QA Date: Tue, 26 Sep 2017 04:18:26 +0000 Deferred-Delivery: Tue, 26 Sep 2017 04:18:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA6A086@SHSMSX103.ccr.corp.intel.com> References: <1506394081-3852-1-git-send-email-eric.dong@intel.com> In-Reply-To: <1506394081-3852-1-git-send-email-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] UefiCpuPkg/CpuCommonFeaturesLib: Add check for input parameter. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 04:15:18 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Eric= Dong Sent: Tuesday, September 26, 2017 10:48 AM To: edk2-devel@lists.01.org Cc: Shao, Ming ; Ni, Ruiyu Subject: [edk2] [Patch] UefiCpuPkg/CpuCommonFeaturesLib: Add check for inpu= t parameter. The ConfigData parameter initialized in *GetConfigData function should not = be NULL in later *Support, *Initilize function, so just add ASSERT code che= ck in these functions. Cc: Ming Shao Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c | 2 ++ UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c b/UefiCpuPkg/L= ibrary/CpuCommonFeaturesLib/Aesni.c index 178bfb5..880f092 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c @@ -68,6 +68,7 @@ AesniSupport ( IS_XEON_E7_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)= || IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel= )) { MsrFeatureConfig =3D (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) Conf= igData; + ASSERT (MsrFeatureConfig !=3D NULL); MsrFeatureConfig[ProcessorNumber].Uint64 =3D AsmReadMsr64 (MSR_SANDY_B= RIDGE_FEATURE_CONFIG); return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI =3D=3D 1); } @@ -112,6 +113,7 @@ AesniInitialize ( // if (CpuInfo->ProcessorInfo.Location.Thread =3D=3D 0) { MsrFeatureConfig =3D (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) Conf= igData; + ASSERT (MsrFeatureConfig !=3D NULL); if ((MsrFeatureConfig[ProcessorNumber].Bits.AESConfiguration & BIT0) = =3D=3D 0) { CPU_REGISTER_TABLE_WRITE_FIELD ( ProcessorNumber, diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c b/UefiCpuP= kg/Library/CpuCommonFeaturesLib/ProcTrace.c index 8a12080..b42f5de 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c @@ -120,6 +120,7 @@ ProcTraceSupport ( // Check if ProcTraceMemorySize option is enabled (0xFF means disable by= user) // ProcTraceData =3D (PROC_TRACE_DATA *) ConfigData; + ASSERT (ProcTraceData !=3D NULL); if ((ProcTraceData->ProcTraceMemSize > RtitTopaMemorySize128M) || (ProcTraceData->ProcTraceOutputScheme > RtitOutputSchemeToPA)) { return FALSE; @@ -191,6 +192,7 @@ ProcTraceInitialize ( RTIT_TOPA_TABLE_ENTRY *TopaEntryPtr; =20 ProcTraceData =3D (PROC_TRACE_DATA *) ConfigData; + ASSERT (ProcTraceData !=3D NULL); =20 MemRegionBaseAddr =3D 0; FirstIn =3D FALSE; -- 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel