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.93; helo=mga11.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 4FEC621163DE9 for ; Fri, 26 Oct 2018 07:23:57 -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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 07:23:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,428,1534834800"; d="scan'208";a="81136727" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga007.fm.intel.com with ESMTP; 26 Oct 2018 07:23:56 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 Oct 2018 07:23:56 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 Oct 2018 07:23:55 -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; Fri, 26 Oct 2018 22:23:54 +0800 From: "Yao, Jiewen" To: "Chiu, Chasel" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] IntelFsp2Pkg: Fixed potentially NULL pointer accessing Thread-Index: AQHUbP0Pwy+oQ25YUkiKaKs0DL+kbaUxlJqg Date: Fri, 26 Oct 2018 14:23:53 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AE31165@shsmsx102.ccr.corp.intel.com> References: <20181026072510.7160-1-chasel.chiu@intel.com> In-Reply-To: <20181026072510.7160-1-chasel.chiu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzI0ZDRjMGUtNmEyMy00NTAyLWE1YjgtMDczMGQ5ZWEzODY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS1Q2K0pLNEE2SWlXenR1eTN4YjFtYU4wRHh0d0gzamJjKzkxWlVXTTdZYW1BbjE1M05ycituZVBIcmNpcHJOayJ9 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] 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 14:23:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 > 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 > 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 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 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