From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 C1A5A8213A for ; Mon, 19 Dec 2016 17:53:20 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 19 Dec 2016 17:53:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,376,1477983600"; d="scan'208";a="914220528" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by orsmga003.jf.intel.com with ESMTP; 19 Dec 2016 17:53:20 -0800 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.227]) by ORSMSX109.amr.corp.intel.com ([169.254.11.188]) with mapi id 14.03.0248.002; Mon, 19 Dec 2016 17:53:20 -0800 From: "Kinney, Michael D" To: "Yao, Jiewen" , "Wu, Hao A" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: "Fan, Jeff" Thread-Topic: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference Thread-Index: AQHSWmJA9X2+o4+lU0S9ASSUAjJrJKEQlh6A//98gwA= Date: Tue, 20 Dec 2016 01:53:19 +0000 Message-ID: References: <1482198106-12044-1-git-send-email-hao.a.wu@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503A8C69FD@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A8C69FD@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDgwNTY0MmYtMTRkOC00ZjE4LWI0ODItZWUyNDQ1YjAyZjYyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Im9CcE95dUtqSWR1akZTTWVwM0lGZDFnNmYrUFN2VVNWdmtBdFZrXC9oUVU0PSJ9 x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 01:53:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen, What is the behavior of the module/platform if this function returns=20 before completing its work? Mike > -----Original Message----- > From: Yao, Jiewen > Sent: Monday, December 19, 2016 5:43 PM > To: Wu, Hao A ; edk2-devel@lists.01.org > Cc: Fan, Jeff ; Kinney, Michael D > > Subject: RE: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL p= tr > dereference >=20 > Reviewed-by: jiewen.yao@intel.com >=20 > > -----Original Message----- > > From: Wu, Hao A > > Sent: Tuesday, December 20, 2016 9:42 AM > > To: edk2-devel@lists.01.org > > Cc: Wu, Hao A ; Yao, Jiewen ;= Fan, > > Jeff ; Kinney, Michael D > > Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr > > dereference > > > > Cc: Jiewen Yao > > Cc: Jeff Fan > > Cc: Michael Kinney > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Hao Wu > > --- > > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > index f4716f3..11fb891 100644 > > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > @@ -1011,6 +1011,10 @@ GetUefiMemoryMap ( > > } > > } while (Status =3D=3D EFI_BUFFER_TOO_SMALL); > > > > + if (MemoryMap =3D=3D NULL) { > > + return ; > > + } > > + > > SortMemoryMap (MemoryMap, UefiMemoryMapSize, mUefiDescriptorSize); > > MergeMemoryMapForNotPresentEntry (MemoryMap, > > &UefiMemoryMapSize, mUefiDescriptorSize); > > > > -- > > 1.9.5.msysgit.0