From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Wed, 31 Jul 2019 04:28:58 -0700 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7B8130833A5; Wed, 31 Jul 2019 11:28:57 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 640DB5C1B5; Wed, 31 Jul 2019 11:28:56 +0000 (UTC) Subject: Re: [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry To: Shenglei Zhang , devel@edk2.groups.io, edk2-devel@lists.01.org Cc: Eric Dong , Ray Ni References: <20190731055630.14956-1-shenglei.zhang@intel.com> From: "Laszlo Ersek" Message-ID: Date: Wed, 31 Jul 2019 13:28:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190731055630.14956-1-shenglei.zhang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 31 Jul 2019 11:28:57 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 07/31/19 07:56, Shenglei Zhang wrote: > The pointer Pml5Entry, returned from call to function > AllocatePageTableMemory, may be null. > So add check for it. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Shenglei Zhang > --- > UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > index a3b62f778741..d7af3b6d7941 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > @@ -375,6 +375,7 @@ SmmInitPageTable ( > // Fill PML5 entry > // > Pml5Entry = (UINT64*)AllocatePageTableMemory (1); > + ASSERT (Pml5Entry != NULL); > *Pml5Entry = (UINTN) Pml4Entry | mAddressEncMask | PAGE_ATTRIBUTE_BITS; > ZeroMem (Pml5Entry + 1, EFI_PAGE_SIZE - sizeof (*Pml5Entry)); > // > I'm quite unhappy about this *pattern* in "PageTbl.c", but I must agree that this patch at least makes the new 5-level paging code consistent with the pattern. Laszlo