From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 B95B821180F34 for ; Sun, 28 Oct 2018 18:11:46 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2018 18:11:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,438,1534834800"; d="scan'208";a="101448273" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by fmsmga004.fm.intel.com with ESMTP; 28 Oct 2018 18:11:45 -0700 Received: from pgsmsx111.gar.corp.intel.com ([169.254.2.208]) by KMSMSX151.gar.corp.intel.com ([169.254.10.231]) with mapi id 14.03.0415.000; Mon, 29 Oct 2018 09:11:44 +0800 From: "Chiu, Chasel" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] IntelFsp2Pkg: Fixed potentially NULL pointer accessing Thread-Index: AQHUbP0ZdScwvKo5HEKoDgVsrCBv7aUxDvSAgARflTA= Date: Mon, 29 Oct 2018 01:11:44 +0000 Message-ID: <3C3EFB470A303B4AB093197B6777CCEC501B4380@PGSMSX111.gar.corp.intel.com> References: <20181026072510.7160-1-chasel.chiu@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503AE31165@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503AE31165@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzI0ZDRjMGUtNmEyMy00NTAyLWE1YjgtMDczMGQ5ZWEzODY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS1Q2K0pLNEE2SWlXenR1eTN4YjFtYU4wRHh0d0gzamJjKzkxWlVXTTdZYW1BbjE1M05ycituZVBIcmNpcHJOayJ9 x-ctpclassification: CTP_NT x-originating-ip: [172.30.20.206] MIME-Version: 1.0 Subject: Re: [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: Mon, 29 Oct 2018 01:11:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. We can do that. I will send patch V2 soon. Thanks! Chasel -----Original Message----- From: Yao, Jiewen=20 Sent: Friday, October 26, 2018 10:24 PM To: Chiu, Chasel ; edk2-devel@lists.01.org Subject: RE: [edk2] [PATCH] IntelFsp2Pkg: Fixed potentially NULL pointer ac= cessing Hi Chasel Can we change " if ((IdtDescriptor.Base =3D=3D 0) && (IdtDescriptor.Limit = =3D=3D 0xFFFF)) {" to " if (IdtDescriptor.Base =3D=3D 0) {" ? That can simplify the logic. Thank you Yao Jiewen > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Chasel, Chiu > Sent: Friday, October 26, 2018 3:25 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen > Subject: [edk2] [PATCH] IntelFsp2Pkg: Fixed potentially NULL pointer=20 > accessing >=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=20 > 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 | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > 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=20 > can support, DeadLoop here! > // > CpuDeadLoop(); > + } else if (IdtDescriptor.Base =3D=3D 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 =3D (UINTN) &IdtTableInStack.IdtTable; > IdtDescriptor.Limit =3D (UINT16)(IdtSize - 1); > -- > 2.13.3.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel