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.65; helo=mga03.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 D2D8B2117FD5E for ; Sun, 28 Oct 2018 18:51:14 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2018 18:51:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,438,1534834800"; d="scan'208";a="95794137" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 28 Oct 2018 18:51:13 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 28 Oct 2018 18:51:13 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 28 Oct 2018 18:51:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0415.000; Mon, 29 Oct 2018 09:51:11 +0800 From: "Yao, Jiewen" To: "Chiu, Chasel" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v2] IntelFsp2Pkg: Fixed potentially NULL pointer accessing Thread-Index: AQHUbyU8xSFZDK/3SkWhHXRmdRZAnaU1dWOg Date: Mon, 29 Oct 2018 01:51:10 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AE35123@shsmsx102.ccr.corp.intel.com> References: <20181029011735.1608-1-chasel.chiu@intel.com> In-Reply-To: <20181029011735.1608-1-chasel.chiu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWZhYTU1NTQtOTY5Yi00Y2JkLTkwZDItYmQyZDgyNTlkZDdlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiclM5WEw3S3hWU2w2d2xhSU91TjhkUnlHWEYrQmtLVE5EanI1WGY1bG9GNjFPbkxtbDZXQ2lVRXZ2XC9GR2lnRisifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] 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: Mon, 29 Oct 2018 01:51:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: Chiu, Chasel > Sent: Monday, October 29, 2018 9:18 AM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Desimone, Nathaniel L > ; Chiu, Chasel > Subject: [PATCH v2] IntelFsp2Pkg: Fixed potentially NULL pointer accessin= g >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1280 >=20 > When copying IDT table in SecMain, the pointer might be > NULL so added the check to fix it. >=20 > Test: Verified on internal platform and boots successfully. >=20 > Cc: Jiewen Yao > Cc: Desimone Nathaniel L > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chasel Chiu > --- > IntelFsp2Pkg/FspSecCore/SecMain.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c > b/IntelFsp2Pkg/FspSecCore/SecMain.c > index f319c68cc5..70460a3c8b 100644 > --- a/IntelFsp2Pkg/FspSecCore/SecMain.c > +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c > @@ -100,7 +100,7 @@ SecStartup ( > // |-------------------|----> TempRamBase > IdtTableInStack.PeiService =3D NULL; > AsmReadIdtr (&IdtDescriptor); > - if ((IdtDescriptor.Base =3D=3D 0) && (IdtDescriptor.Limit =3D=3D 0xFFF= F)) { > + if (IdtDescriptor.Base =3D=3D 0) { > ExceptionHandler =3D FspGetExceptionHandler(mIdtEntryTemplate); > for (Index =3D 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); > Index ++) { > CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], > (VOID*)&ExceptionHandler, sizeof (UINT64)); > @@ -113,8 +113,9 @@ SecStartup ( > // ERROR: IDT table size from boot loader is larger than FSP can > support, DeadLoop here! > // > CpuDeadLoop(); > + } else { > + CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) > IdtDescriptor.Base, IdtSize); > } > - CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) > IdtDescriptor.Base, IdtSize); > } > IdtDescriptor.Base =3D (UINTN) &IdtTableInStack.IdtTable; > IdtDescriptor.Limit =3D (UINT16)(IdtSize - 1); > -- > 2.13.3.windows.1