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.24; helo=mga09.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 385622095B093 for ; Sun, 8 Oct 2017 20:14:55 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2017 20:18:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,498,1500966000"; d="scan'208";a="136522913" Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.57]) by orsmga004.jf.intel.com with ESMTP; 08 Oct 2017 20:18:20 -0700 From: Eric Dong To: edk2-devel@lists.01.org Cc: Ruiyu Ni Date: Mon, 9 Oct 2017 11:18:18 +0800 Message-Id: <1507519098-14284-1-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [Patch] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to void use null pointer. 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: Mon, 09 Oct 2017 03:14:55 -0000 Current code logic not check the pointer before use it. This may has potential issue, this patch add code to check it. Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c index ef72b9b..2c1dc82 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -226,12 +226,17 @@ SetProcessorRegister ( CPU_REGISTER_TABLE *RegisterTable; InitApicId = GetInitialApicId (); + RegisterTable = NULL; for (Index = 0; Index < RegisterTableCount; Index++) { if (RegisterTables[Index].InitialApicId == InitApicId) { RegisterTable = &RegisterTables[Index]; break; } } + ASSERT (RegisterTable != NULL); + if (RegisterTable == NULL) { + return; + } // // Traverse Register Table of this logical processor -- 2.7.0.windows.1