From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ACF3E820FE for ; Mon, 19 Dec 2016 18:38:47 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 19 Dec 2016 18:38:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,376,1477983600"; d="scan'208";a="1074244582" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 19 Dec 2016 18:38:47 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Dec 2016 18:38:47 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Dec 2016 18:38:47 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.9]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.11]) with mapi id 14.03.0248.002; Tue, 20 Dec 2016 10:38:45 +0800 From: "Wu, Hao A" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Fan, Jeff" , "Kinney, Michael D" Thread-Topic: [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference Thread-Index: AQHSWmflq2lk3Mq/DU+HDsU4Z2jjg6EPmGmAgACHBKA= Date: Tue, 20 Dec 2016 02:38:44 +0000 Message-ID: References: <1482200536-11784-1-git-send-email-hao.a.wu@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503A8C6AFD@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A8C6AFD@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] 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 02:38:47 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Got it. I will remove those debug messages before check-in. Best Regards, Hao Wu > -----Original Message----- > From: Yao, Jiewen > Sent: Tuesday, December 20, 2016 10:35 AM > To: Wu, Hao A; edk2-devel@lists.01.org > Cc: Fan, Jeff; Kinney, Michael D > Subject: RE: [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid > NULL ptr dereference >=20 > Thanks. >=20 > This function will be called in SMM exception handlers. The exception inf= o will > be displayed later. > There is no need to add debug message here. Please remove it. >=20 > With that change, reviewed-by: Jiewen.yao@intel.com >=20 > > -----Original Message----- > > From: Wu, Hao A > > Sent: Tuesday, December 20, 2016 10:22 AM > > To: edk2-devel@lists.01.org > > Cc: Wu, Hao A ; Yao, Jiewen ; > Fan, > > Jeff ; Kinney, Michael D > > Subject: [PATCH v2] 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 | 11 > > +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > > index f4716f3..d967255 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); > > > > @@ -1080,6 +1084,13 @@ IsSmmCommBufferForbiddenAddress ( > > UINTN MemoryMapEntryCount; > > UINTN Index; > > > > + DEBUG ((DEBUG_INFO, "IsSmmCommBufferForbiddenAddress\n")); > > + > > + if (mUefiMemoryMap =3D=3D NULL) { > > + DEBUG ((DEBUG_INFO, "UefiMemoryMap - NULL\n")); > > + return FALSE; > > + } > > + > > MemoryMap =3D mUefiMemoryMap; > > MemoryMapEntryCount =3D mUefiMemoryMapSize/mUefiDescriptorSize; > > for (Index =3D 0; Index < MemoryMapEntryCount; Index++) { > > -- > > 1.9.5.msysgit.0