From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.32330.1590999212997811790 for ; Mon, 01 Jun 2020 01:13:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=km64TlsY; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: dandan.bi@intel.com) IronPort-SDR: 9OBHOhb2gr/4n/DDIef0ZnSor8KWsVJWw8uMFnHDAsS4uE8LtE5nnK4cDt5C7xaX5kdfiUKhug KhQMOUi14Wkw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 01:13:32 -0700 IronPort-SDR: zIbdoMYz+dzPGTy8kHPhMgWDiVC5IRn3JdI7RQs9S+tisn5DnEXQ0grvF4U5qRWRNqve8v96h6 VhP3WJLW7eSA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,460,1583222400"; d="scan'208";a="470208588" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by fmsmga006.fm.intel.com with ESMTP; 01 Jun 2020 01:13:31 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 1 Jun 2020 01:13:31 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 1 Jun 2020 01:13:31 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 1 Jun 2020 01:13:31 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 1 Jun 2020 01:13:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOBDYJ+LULY3yv3fGBG6LI4GnBjKn8NEtWIwf1Et9pu+UWCbpALAthwSzm5l816lPaPe0b18CpQN8vaEfoMJ9z5DZ3MT27h8Pb14jKcZJsyi04uofUTdcWtpn1wTfYQMq8boN8AALrHViASjrTL9ONLC6ovSq8cOLVpMeFcVY47+sBuKye1x3Jo5GKcsEib3vFMV7KLlhhLzCfYXyw4W//PaUari0+k6fbWU1aGgw6c+2Rv6fVEVt+hr8kW0XwjGUe9L7Gjg6evqcZRz3I5RqilSm6NuoKcPf/mxj+qnO6veG8X/sMJO6dbHr6M1wGI4ADXZy7FekSQAN/zP8bvQ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q5POVEXywf1c4TprRQD+R/pWElXLeELn+6VbU/PCA2Y=; b=DByVyPVK8gq6i85mwC0L8l7/v2nMVv0cU7caekqfnywigJG0wBcHx0VuXUC9ZYTbjaIbfcjPISlpO1gd+Mae/BASPQj89391GcEFI4LTmugqSWzUL+mOMYWBeWNkrpodDKuQZyW8T3OqWQ2BNos5/eCu6JBscNFUsR2zac4moUwfPxCRdOlMba8oj9y0wZOpCmPMoygMF2wT4WZwBdUJaLRP3DTS1eroGO9wZsNJ8Ekq88fuXc4nbPVazhKR11MEQr/9xyFn7xFYBMYk1yDEajtRx3TQAjBx/N4OwdgdNB11zU98WrwmjHU55tevvruUVfZokiyPBEC4g4IlXEjOhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q5POVEXywf1c4TprRQD+R/pWElXLeELn+6VbU/PCA2Y=; b=km64TlsYyUPqIF/kGYEjwGLE+8lx0I/pBklBP38pfCTnBGd3n2SHxuk7Vf6JdHgVZ3qVp88seFhVGHJSNjXlc75N/vco3HzQvrX+w+qiutYgZ8XjuKo3wy401lur2c4gQTczsKiaZ2JgM0pDlyZbqRB3K5iOvbBhHxSonqXEupQ= Received: from BN6PR11MB1393.namprd11.prod.outlook.com (2603:10b6:404:3c::12) by BN6PR11MB1380.namprd11.prod.outlook.com (2603:10b6:404:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Mon, 1 Jun 2020 08:13:27 +0000 Received: from BN6PR11MB1393.namprd11.prod.outlook.com ([fe80::a1f4:15d6:9a79:de03]) by BN6PR11MB1393.namprd11.prod.outlook.com ([fe80::a1f4:15d6:9a79:de03%11]) with mapi id 15.20.3045.024; Mon, 1 Jun 2020 08:13:27 +0000 From: "Dandan Bi" To: "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: "Wang, Jian J" , "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove unused function arguments Thread-Topic: [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove unused function arguments Thread-Index: AQHWDolcqZl1DpQjgEqdRY8nxEHuv6jDuvKQ Date: Mon, 1 Jun 2020 08:13:27 +0000 Message-ID: References: <20200409160948.23427-1-ard.biesheuvel@arm.com> <20200409160948.23427-3-ard.biesheuvel@arm.com> In-Reply-To: <20200409160948.23427-3-ard.biesheuvel@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f2cd411f-7eba-4447-75fd-08d80603a9dd x-ms-traffictypediagnostic: BN6PR11MB1380: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0421BF7135 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ReubYD8vvLiRGVPrcMY3eaNjd19p5jRjzgMIh1MoP96PilmHnQW+hzs9srpp1hkldAkIIQLJ2H8BFadqOAG5+4/HSoxeZJzEGEI1eOHbGQ2Z3GurRUk5G6Uds5nRwNqQthOYYknlRarWEUXtz5F5Vm3hM6uegNppsz0Zo8tvNO367SnUx9wllEDKnAxvv/oFpLiF3G8XGd/Klqyy1Skmqc5q/Lyh+Y/WUuUMtSyP9gIN66qCxi+NtxoP7Lotg6tfGtkZ0CXWnpBvxKkkcKBHTu8ytcPxVgRm8Y4ba+nrpwTQS4ILEccEV9EqnCv+um+muWwlTP8plY9k8qQ7iGiOPRDcJ5zpCPsf1qoJC+ohcjcqyl+GTT4ZlZkl0jH2StYcosk/qzIIbkAjlzmk1ZdYxA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB1393.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(39860400002)(346002)(396003)(136003)(376002)(366004)(110136005)(54906003)(8936002)(478600001)(52536014)(2906002)(316002)(66446008)(186003)(66556008)(76116006)(66946007)(26005)(53546011)(64756008)(66476007)(966005)(7696005)(8676002)(6506007)(86362001)(33656002)(55016002)(71200400001)(83380400001)(107886003)(5660300002)(9686003)(4326008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: KFPSOD7YTlO06kpKbfQoGhfchNuQXERxY5jGEk//xwktgyOS/Yi61kBb+I11N0oRLUWM7Ph/7P5GnVIa8FuuwPlSKyp1eoUdoVg+qgENMwEDH/IVOnCCKvFcj8Pv5Cfs4HXDjCUeiULHmiFhL8c7NtDBfHVm5IiwbGOTu5eKLpzYkXgOQO6yrU2GM5J9kFQL90VJ+3Okqtwx8kF7VGwsj83d9IkHIPHwO64FX1gnrIBR9kBD133ZfSeyafRRQFnXylWYNR6C1fHB371MGmYKjbvohoOFuFpr+Io6upa6NHpYLap73OuA8S5Kk+QJdwK33TvvA1NNd+Vx9joDyHoUP/wOqRrh3k6Do0/TZktqbcYP+pDGnRSapyYYvX4+p5NUA09v3MBdI4iHAoyu+R3K1bSgI2zOE0W0jvm1V2ANsXumohoi0JLSKmp8PIQs/SlLlrwneB1Vu0lErgVeBcFqvCRyVPWLrL12HIWkhefUgC5fh8mcZdugJ9r+hK6Imt9B MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f2cd411f-7eba-4447-75fd-08d80603a9dd X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jun 2020 08:13:27.5987 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MpUOvbKuC1l8Toxf/Q5cBFzhc65o+1I7fdlpbXhMagaBuk1pT+64/GuWfmngpJcnEEM3LJcUbRenHGUXPwtwyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1380 Return-Path: dandan.bi@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ard, Some minor comments, 1. Could you please also remove the arguments in related function comments= ? 2. Please make the code aligned after removing some condition check. Thanks, Dandan > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ard > Biesheuvel > Sent: Friday, April 10, 2020 12:10 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A = ; > Ard Biesheuvel > Subject: [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove > unused function arguments >=20 > Image.c defines a CoreLoadImageCommon() function that has some > arguments that are marked OPTIONAL. The function only has a single calle= r > living in the same file, and it does not pass any arguments for these > OPTIONAL arguments. >=20 > So let's simplify the code, and remove these arguments and all the trans= itive > conditional dependencies on them. >=20 > Signed-off-by: Ard Biesheuvel > --- >=20 > NOTE: this patch was generated with the -w option, to suppress indentati= on > changes from cluttering the diff. >=20 > MdeModulePkg/Core/Dxe/Image/Image.c | 81 ++------------------ > 1 file changed, 7 insertions(+), 74 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c > b/MdeModulePkg/Core/Dxe/Image/Image.c > index aae2c1eaa516..9fdde87f2df3 100644 > --- a/MdeModulePkg/Core/Dxe/Image/Image.c > +++ b/MdeModulePkg/Core/Dxe/Image/Image.c > @@ -564,13 +564,10 @@ CoreLoadPeImage ( > IN BOOLEAN BootPolicy, > IN VOID *Pe32Handle, > IN LOADED_IMAGE_PRIVATE_DATA *Image, > - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, > - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, > IN UINT32 Attribute > ) > { > EFI_STATUS Status; > - BOOLEAN DstBufAlocated; > UINTN Size; >=20 > ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext)); @@ - > 619,15 +616,6 @@ CoreLoadPeImage ( > return EFI_UNSUPPORTED; > } >=20 > - // > - // Allocate memory of the correct memory type aligned on the required > image boundary > - // > - DstBufAlocated =3D FALSE; > - if (DstBuffer =3D=3D 0) { > - // > - // Allocate Destination Buffer as caller did not pass it in > - // > - > if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZE) { > Size =3D (UINTN)Image->ImageContext.ImageSize + Image- > >ImageContext.SectionAlignment; > } else { > @@ -685,31 +673,6 @@ CoreLoadPeImage ( > if (EFI_ERROR (Status)) { > return Status; > } > - DstBufAlocated =3D TRUE; > - } else { > - // > - // Caller provided the destination buffer > - // > - > - if (Image->ImageContext.RelocationsStripped && (Image- > >ImageContext.ImageAddress !=3D DstBuffer)) { > - // > - // If the image relocations were stripped, and the caller provide= d a > - // destination buffer address that does not match the address tha= t the > - // image is linked at, then the image cannot be loaded. > - // > - return EFI_INVALID_PARAMETER; > - } > - > - if (Image->NumberOfPages !=3D 0 && > - Image->NumberOfPages < > - (EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + > Image->ImageContext.SectionAlignment))) { > - Image->NumberOfPages =3D EFI_SIZE_TO_PAGES ((UINTN)Image- > >ImageContext.ImageSize + Image->ImageContext.SectionAlignment); > - return EFI_BUFFER_TOO_SMALL; > - } > - > - Image->NumberOfPages =3D EFI_SIZE_TO_PAGES ((UINTN)Image- > >ImageContext.ImageSize + Image->ImageContext.SectionAlignment); > - Image->ImageContext.ImageAddress =3D DstBuffer; > - } >=20 > Image->ImageBasePage =3D Image->ImageContext.ImageAddress; > if (!Image->ImageContext.IsTeImage) { @@ -790,13 +753,6 @@ > CoreLoadPeImage ( > } > } >=20 > - // > - // Fill in the entry point of the image if it is available > - // > - if (EntryPoint !=3D NULL) { > - *EntryPoint =3D Image->ImageContext.EntryPoint; > - } > - > // > // Print the load address and the PDB file name if it is available > // > @@ -861,11 +817,9 @@ CoreLoadPeImage ( > // Free memory. > // >=20 > - if (DstBufAlocated) { > CoreFreePages (Image->ImageContext.ImageAddress, Image- > >NumberOfPages); > Image->ImageContext.ImageAddress =3D 0; > Image->ImageBasePage =3D 0; > - } >=20 > if (Image->ImageContext.FixupData !=3D NULL) { > CoreFreePool (Image->ImageContext.FixupData); @@ -920,8 +874,7 @@ > CoreLoadedImageInfo ( STATIC VOID CoreUnloadAndCloseImage ( > - IN LOADED_IMAGE_PRIVATE_DATA *Image, > - IN BOOLEAN FreePage > + IN LOADED_IMAGE_PRIVATE_DATA *Image > ) > { > EFI_STATUS Status; > @@ -1047,7 +1000,7 @@ CoreUnloadAndCloseImage ( > // > // Free the Image from memory > // > - if ((Image->ImageBasePage !=3D 0) && FreePage) { > + if ((Image->ImageBasePage !=3D 0)) { > CoreFreePages (Image->ImageBasePage, Image->NumberOfPages); > } >=20 > @@ -1122,10 +1075,7 @@ CoreLoadImageCommon ( > IN EFI_DEVICE_PATH_PROTOCOL *FilePath, > IN VOID *SourceBuffer OPTIONAL, > IN UINTN SourceSize, > - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, > - IN OUT UINTN *NumberOfPages OPTIONAL, > OUT EFI_HANDLE *ImageHandle, > - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, > IN UINT32 Attribute > ) > { > @@ -1330,12 +1280,7 @@ CoreLoadImageCommon ( > Image->Info.FilePath =3D DuplicateDevicePath (FilePath); > Image->Info.ParentHandle =3D ParentImageHandle; >=20 > - > - if (NumberOfPages !=3D NULL) { > - Image->NumberOfPages =3D *NumberOfPages ; > - } else { > Image->NumberOfPages =3D 0 ; > - } >=20 > // > // Install the protocol interfaces for this image @@ -1355,20 +1300,1= 1 @@ > CoreLoadImageCommon ( > // > // Load the image. If EntryPoint is Null, it will not be set. > // > - Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, DstBuffer, > EntryPoint, Attribute); > + Status =3D CoreLoadPeImage (BootPolicy, &FHand, Image, Attribute); > if (EFI_ERROR (Status)) { > - if ((Status =3D=3D EFI_BUFFER_TOO_SMALL) || (Status =3D=3D > EFI_OUT_OF_RESOURCES)) { > - if (NumberOfPages !=3D NULL) { > - *NumberOfPages =3D Image->NumberOfPages; > - } > - } > goto Done; > } >=20 > - if (NumberOfPages !=3D NULL) { > - *NumberOfPages =3D Image->NumberOfPages; > - } > - > // > // Register the image in the Debug Image Info Table if the attribute = is set > // > @@ -1448,7 +1384,7 @@ CoreLoadImageCommon ( > // > if (EFI_ERROR (Status)) { > if (Image !=3D NULL) { > - CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer =3D=3D 0)); > + CoreUnloadAndCloseImage (Image); > Image =3D NULL; > } > } else if (EFI_ERROR (SecurityStatus)) { @@ -1524,10 +1460,7 @@ > CoreLoadImage ( > FilePath, > SourceBuffer, > SourceSize, > - (EFI_PHYSICAL_ADDRESS) (UINTN) NULL, > - NULL, > ImageHandle, > - NULL, > EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | > EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRA > TION > ); >=20 > @@ -1744,7 +1677,7 @@ CoreStartImage ( > // unload it > // > if (EFI_ERROR (Image->Status) || Image->Type =3D=3D > EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) { > - CoreUnloadAndCloseImage (Image, TRUE); > + CoreUnloadAndCloseImage (Image); > // > // ImageHandle may be invalid after the image is unloaded, so use N= ULL > handle to record perf log. > // > @@ -1809,7 +1742,7 @@ CoreExit ( > // > // The image has not been started so just free its resources > // > - CoreUnloadAndCloseImage (Image, TRUE); > + CoreUnloadAndCloseImage (Image); > Status =3D EFI_SUCCESS; > goto Done; > } > @@ -1911,7 +1844,7 @@ CoreUnloadImage ( > // > // if the Image was not started or Unloaded O.K. then clean up > // > - CoreUnloadAndCloseImage (Image, TRUE); > + CoreUnloadAndCloseImage (Image); > } >=20 > Done: > -- > 2.17.1 >=20 >=20 >=20