From nobody Wed May 8 21:14:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78883+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78883+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1628451637; cv=none; d=zohomail.com; s=zohoarc; b=LOcC65or3Tg+XIdP1E1+TO4QAaP3UmiN/BFRAZZyGElh6QOI3Ir0aZOMaZYv5G3EWLf8wKJruGkUbTCvMXsk9y0gJLPSBn14rWYAKR0hrOmi/sHB+KzYV5nlGzlFn8dYj0wBq2OzivYsRS7ipfaXCGZ7kGIvL8zbfKSw/wDwLJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628451637; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1zwBgaXLIzlh2RufnqLJ5drlXdUfW/h59z2Y7S7zuhI=; b=LUKtydyU8RUNW3fz1r71ptqfBqIRqK4dk45Tajjp1zbodi9JAgx3OwJMoQf4NQN1vbvfWeWHODFeZgn0Uw5CJFIUdETuJjUP1G4wlw8OAcoIMzbM5ODPAU75s7RbKSB3Lz2FD91x0QH+KCWjaU/urIF6sDNt1Q0AaJn+3io/NOA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78883+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628451637308297.5983229655525; Sun, 8 Aug 2021 12:40:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ESHmYY1788612xctESQAxpWO; Sun, 08 Aug 2021 12:40:37 -0700 X-Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web09.13696.1628451636086406752 for ; Sun, 08 Aug 2021 12:40:36 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 89335240029 for ; Sun, 8 Aug 2021 21:40:34 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GjV1X1FH7z6tmF; Sun, 8 Aug 2021 21:40:32 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao , Vitaly Cheptsov Subject: [edk2-devel] [PATCH] MdeModulePkg/DxeCore: Drop unnecessary pointer indirection Date: Sun, 8 Aug 2021 19:39:41 +0000 Message-Id: <57141c34a0fec63b23fcecb156c4c6db8f008f9e.1628360136.git.mhaeuser@posteo.de> In-Reply-To: <5df11a13422732b9c03c120775a2b4dd0a49182f.1628444003.git.mhaeuser@posteo.de> References: <5df11a13422732b9c03c120775a2b4dd0a49182f.1628444003.git.mhaeuser@posteo.de> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mhaeuser@posteo.de X-Gm-Message-State: c6pNPrvn9gi8jk1xms7DQQeNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628451637; bh=1acwxC9lp4KAUzFshvEv1g8X2S+tYhM8hAM2oWSrVS8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ryCPPH5ByThCBgWSx5ogCSudn+1A12BC8nLb+S7GOqhXm9SwVFS4P6bAwhn4tZfXZ4k bMILT1v4Pk0nEXa06Rz/Zf2He/x2GpiFuCbcfDgLv1lFYUphkhESvgiSmhqWmfzhZtAlx cpGlBaOIzVcEdLKNfhDZpJuAohqeJS0VQBE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628451639539100029 Content-Type: text/plain; charset="utf-8" CoreInitializeGcdServices() takes a pointer-to-pointer for the first HOB. However, it is dereferenced in every operation inside. To mitigate confusion whether or not it can be re-allocated by the callee, remove the unnecessary indirection. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 +- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 10 +++++----- MdeModulePkg/Core/Dxe/DxeMain.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dx= e/DxeMain/DxeMain.c index db21311f9352..1a8f6b57f356 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -263,7 +263,7 @@ DxeMain ( // // Initialize Memory Services // - CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLeng= th); + CoreInitializeMemoryServices (HobStart, &MemoryBaseAddress, &MemoryLengt= h); =20 MemoryProfileInit (HobStart); =20 diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc= d.c index 51b082b7e7eb..af9e9e315819 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2168,7 +2168,7 @@ FindLargestFreeRegion ( **/ EFI_STATUS CoreInitializeMemoryServices ( - IN VOID **HobStart, + IN VOID *HobStart, OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress, OUT UINT64 *MemoryLength ) @@ -2194,7 +2194,7 @@ CoreInitializeMemoryServices ( // // Point at the first HOB. This must be the PHIT HOB. // - Hob.Raw =3D *HobStart; + Hob.Raw =3D HobStart; ASSERT (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_HANDOFF); =20 // @@ -2248,7 +2248,7 @@ CoreInitializeMemoryServices ( // Find the Resource Descriptor HOB that contains PHIT range EfiFreeMemo= ryBottom..EfiFreeMemoryTop // Found =3D FALSE; - for (Hob.Raw =3D *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT_= HOB(Hob)) { + for (Hob.Raw =3D HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT_H= OB(Hob)) { // // Skip all HOBs except Resource Descriptor HOBs // @@ -2304,7 +2304,7 @@ CoreInitializeMemoryServices ( // Compute range between the start of the Resource Descriptor HOB = and the start of the HOB List // BaseAddress =3D PageAlignAddress (ResourceHob->PhysicalStart); - Length =3D PageAlignLength ((UINT64)((UINTN)*HobStart - Base= Address)); + Length =3D PageAlignLength ((UINT64)((UINTN)HobStart - BaseA= ddress)); FindLargestFreeRegion (&BaseAddress, &Length, (EFI_HOB_MEMORY_ALLO= CATION *)GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION)); } } @@ -2329,7 +2329,7 @@ CoreInitializeMemoryServices ( // The max address must be within the physically addressible range for= the processor. // HighAddress =3D MAX_ALLOC_ADDRESS; - for (Hob.Raw =3D *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEX= T_HOB(Hob)) { + for (Hob.Raw =3D HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT= _HOB(Hob)) { // // Skip the Resource Descriptor HOB that contains the PHIT // diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMai= n.h index 9bd3c0d08411..8f268dd2854a 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -366,7 +366,7 @@ CoreAcquireGcdMemoryLock ( **/ EFI_STATUS CoreInitializeMemoryServices ( - IN VOID **HobStart, + IN VOID *HobStart, OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress, OUT UINT64 *MemoryLength ); --=20 2.31.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#78883): https://edk2.groups.io/g/devel/message/78883 Mute This Topic: https://groups.io/mt/84754056/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-