From nobody Thu Dec 26 00:45:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1506394091862385.48657565912697; Mon, 25 Sep 2017 19:48:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 75B602095E534; Mon, 25 Sep 2017 19:44:58 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 55E212095E529 for ; Mon, 25 Sep 2017 19:44:55 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 25 Sep 2017 19:48:05 -0700 Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.57]) by orsmga005.jf.intel.com with ESMTP; 25 Sep 2017 19:48:03 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,438,1500966000"; d="scan'208";a="153301202" From: Eric Dong To: edk2-devel@lists.01.org Date: Tue, 26 Sep 2017 10:48:01 +0800 Message-Id: <1506394081-3852-1-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [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: , Cc: Ming Shao , Ruiyu Ni MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The ConfigData parameter initialized in *GetConfigData function should not = be NULL in later *Support, *Initilize function, so just add ASSERT code check in these= functions. Cc: Ming Shao Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong Reviewed-by: Ruiyu Ni --- 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; --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel