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 F22AD81924 for ; Sun, 8 Jan 2017 21:18:44 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 08 Jan 2017 21:18:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,339,1477983600"; d="scan'208";a="211106770" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 08 Jan 2017 21:18:44 -0800 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 8 Jan 2017 21:18:44 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 8 Jan 2017 21:18:44 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Mon, 9 Jan 2017 13:18:42 +0800 From: "Gao, Liming" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Zeng, Star" Thread-Topic: [edk2] [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages Thread-Index: AQHSajVfT5wBNHFPlEaJlSpe7GyS66Evm0Iw Date: Mon, 9 Jan 2017 05:18:42 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6CACD7@shsmsx102.ccr.corp.intel.com> References: <1483938017-28240-1-git-send-email-michael.d.kinney@intel.com> In-Reply-To: <1483938017-28240-1-git-send-email-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages 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: Mon, 09 Jan 2017 05:18:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Michael Kinney >Sent: Monday, January 09, 2017 1:00 PM >To: edk2-devel@lists.01.org >Cc: Tian, Feng ; Zeng, Star >Subject: [edk2] [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD >DEBUG() messages > >If a BaseAddress of NULL is passed into DXE Core services >CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and >DEBUG() messages are enabled, then a NULL pointer reference >is made. The parameter check for BaseAddress is performed >in the function CoreAllocateSpace() after the DEBUG() >messages. A check is added in the DEBUG() messages to >prevent the NULL pointer reference. > >This issue was found with PI SCTs with DEBUG messages >enabled in the DXE Core. > >Cc: Feng Tian >Cc: Star Zeng >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Michael Kinney >--- > MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > >diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c >b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c >index bd7c6c6..e008ce8 100644 >--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c >+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c >@@ -3,7 +3,7 @@ > The GCD services are used to manage the memory and I/O regions that > are accessible to the CPU that is executing the DXE core. > >-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
>+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD >License > which accompanies this distribution. The full text of the license may be= found >at >@@ -1337,7 +1337,11 @@ CoreAllocateMemorySpace ( > IN EFI_HANDLE DeviceHandle OPTIONAL > ) > { >- DEBUG ((DEBUG_GCD, >"GCD:AllocateMemorySpace(Base=3D%016lx,Length=3D%016lx)\n", *BaseAddress, >Length)); >+ if (BaseAddress !=3D NULL) { >+ DEBUG ((DEBUG_GCD, >"GCD:AllocateMemorySpace(Base=3D%016lx,Length=3D%016lx)\n", *BaseAddress, >Length)); >+ } else { >+ DEBUG ((DEBUG_GCD, >"GCD:AllocateMemorySpace(Base=3D,Length=3D%016lx)\n", Length)); >+ } > DEBUG ((DEBUG_GCD, " GcdAllocateType =3D %a\n", >mGcdAllocationTypeNames[MIN (GcdAllocateType, >EfiGcdMaxAllocateType)])); > DEBUG ((DEBUG_GCD, " GcdMemoryType =3D %a\n", >mGcdMemoryTypeNames[MIN (GcdMemoryType, >EfiGcdMemoryTypeMaximum)])); > DEBUG ((DEBUG_GCD, " Alignment =3D %016lx\n", LShiftU64 (1, >Alignment))); >@@ -1761,7 +1765,11 @@ CoreAllocateIoSpace ( > IN EFI_HANDLE DeviceHandle OPTIONAL > ) > { >- DEBUG ((DEBUG_GCD, >"GCD:AllocateIoSpace(Base=3D%016lx,Length=3D%016lx)\n", *BaseAddress, >Length)); >+ if (BaseAddress !=3D NULL) { >+ DEBUG ((DEBUG_GCD, >"GCD:AllocateIoSpace(Base=3D%016lx,Length=3D%016lx)\n", *BaseAddress, >Length)); >+ } else { >+ DEBUG ((DEBUG_GCD, >"GCD:AllocateIoSpace(Base=3D,Length=3D%016lx)\n", Length)); >+ } > DEBUG ((DEBUG_GCD, " GcdAllocateType =3D %a\n", >mGcdAllocationTypeNames[MIN (GcdAllocateType, >EfiGcdMaxAllocateType)])); > DEBUG ((DEBUG_GCD, " GcdIoType =3D %a\n", mGcdIoTypeNames[MIN >(GcdIoType, EfiGcdIoTypeMaximum)])); > DEBUG ((DEBUG_GCD, " Alignment =3D %016lx\n", LShiftU64 (1, >Alignment))); >-- >2.6.3.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel