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.126; helo=mga18.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 2BF702117B57A for ; Fri, 26 Oct 2018 00:25:15 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 00:25:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,427,1534834800"; d="scan'208";a="81063671" Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.24]) by fmsmga007.fm.intel.com with ESMTP; 26 Oct 2018 00:25:14 -0700 From: "Chasel, Chiu" To: edk2-devel@lists.01.org Cc: Jiewen Yao , Desimone Nathaniel L , Chasel Chiu Date: Fri, 26 Oct 2018 15:25:10 +0800 Message-Id: <20181026072510.7160-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 Subject: [PATCH] IntelFsp2Pkg: Fixed potentially NULL pointer accessing X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 07:25:16 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1280 When copying IDT table in SecMain, the pointer might be NULL so added the check to fix it. Test: Verified on internal platform and boots successfully. Cc: Jiewen Yao Cc: Desimone Nathaniel L Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu --- IntelFsp2Pkg/FspSecCore/SecMain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/SecMain.c index f319c68cc5..aed8893ff0 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.c +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c @@ -113,8 +113,14 @@ SecStartup ( // ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here! // CpuDeadLoop(); + } else if (IdtDescriptor.Base == 0) { + // + // ERROR: IDT table Base should not be zero, DeadLoop here! + // + CpuDeadLoop(); + } else { + CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize); } - CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize); } IdtDescriptor.Base = (UINTN) &IdtTableInStack.IdtTable; IdtDescriptor.Limit = (UINT16)(IdtSize - 1); -- 2.13.3.windows.1