From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B58388212A for ; Mon, 19 Dec 2016 17:42:59 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP; 19 Dec 2016 17:42:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,376,1477983600"; d="scan'208";a="44423079" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2016 17:42:59 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 19 Dec 2016 17:42:59 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.54]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.159]) with mapi id 14.03.0248.002; Tue, 20 Dec 2016 09:42:58 +0800 From: "Yao, Jiewen" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Fan, Jeff" , "Kinney, Michael D" Thread-Topic: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference Thread-Index: AQHSWmJChbPOEz3gRk+wUoTAeUY/mqEQD+vA Date: Tue, 20 Dec 2016 01:42:57 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8C69FD@shsmsx102.ccr.corp.intel.com> References: <1482198106-12044-1-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1482198106-12044-1-git-send-email-hao.a.wu@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] 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:42:59 -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: Wu, Hao A > Sent: Tuesday, December 20, 2016 9:42 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Yao, Jiewen ; F= an, > Jeff ; Kinney, Michael D > Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr > dereference >=20 > 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(+) >=20 > 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); >=20 > + if (MemoryMap =3D=3D NULL) { > + return ; > + } > + > SortMemoryMap (MemoryMap, UefiMemoryMapSize, mUefiDescriptorSize); > MergeMemoryMapForNotPresentEntry (MemoryMap, > &UefiMemoryMapSize, mUefiDescriptorSize); >=20 > -- > 1.9.5.msysgit.0