From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.12108.1647966144543144962 for ; Tue, 22 Mar 2022 09:22:24 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=iIB82e8U; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.202.59.224]) by linux.microsoft.com (Postfix) with ESMTPSA id 39D5020B4783; Tue, 22 Mar 2022 09:22:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 39D5020B4783 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1647966144; bh=vrI76H/JQSjwvNiMUqhigD6Bzr/CePVUeTK2Rw+nYA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iIB82e8UP6T5hTfyQoy/lsqsVjLGQqk6wwafgg20J8HfyulQBhdjYaMwBPqDr83d1 xPc3dqYZkGtZ1u9vPY0GCRPJpACwb9gdt9fABr0UZ/OTvyWa78f3dsrWSR5mqIQmOQ aADVO6Vox385l54w7URaRgv7rihQTN/AHnzl7pjE= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Andrew Fish , Kang Gao , Michael D Kinney , Michael Kubacki , Leif Lindholm , Benjamin You , Liu Yun , Ankit Sinha , Nate DeSimone Subject: [PATCH v1 27/41] PrmPkg: Enforce stricter types Date: Tue, 22 Mar 2022 12:19:33 -0400 Message-Id: <20220322161947.9319-28-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20220322161947.9319-1-mikuback@linux.microsoft.com> References: <20220322161947.9319-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki Makes the following changes to enforce stricter types: 1. PrmPkg/PrmConfigDxe The function PrmConfigEndOfDxeNotification () is used as a notify function (of type EFI_EVENT_NOTIFY), however it has a return type of EFI_STATUS whereas the return type should actually be VOID. 2. PrmPkg/PrmLoaderDxe Updates the following types to be more accurate than were allowed in the VS compiler: * 3rd actual argument given to GetModuleContextBuffers () is explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS ** * 3rd actual argument given to GetContextBuffer () is explicitly marked as CONST PRM_CONTEXT_BUFFER ** * PrmLoaderEndOfDxeNotification () return type is changed to VOID to align with the EFI_EVENT_NOTIFY type 3. PrmPkg/Application/PrmInfo Updates the following types to be more accurate than were allowed in the VS compiler: * SHELL_STATUS in ParseParameterList () is now EFI_STATUS * 3rd actual argument given to GetModuleContextBuffers () is explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS ** * 3rd actual argument given to GetContextBuffer () is explicitly marked as CONST PRM_CONTEXT_BUFFER ** Cc: Andrew Fish Cc: Kang Gao Cc: Michael D Kinney Cc: Michael Kubacki Cc: Leif Lindholm Cc: Benjamin You Cc: Liu Yun Cc: Ankit Sinha Cc: Nate DeSimone Signed-off-by: Michael Kubacki --- PrmPkg/Application/PrmInfo/PrmInfo.c | 6 +++--- PrmPkg/PrmConfigDxe/PrmConfigDxe.c | 8 ++------ PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c | 10 +++------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/PrmPkg/Application/PrmInfo/PrmInfo.c b/PrmPkg/Application/Pr= mInfo/PrmInfo.c index 431a6f206163..e479667ec7eb 100644 --- a/PrmPkg/Application/PrmInfo/PrmInfo.c +++ b/PrmPkg/Application/PrmInfo/PrmInfo.c @@ -221,7 +221,7 @@ GatherPrmHandlerInfo ( Status =3D GetModuleContextBuffers ( ByModuleGuid, CurrentModuleGuid, - &CurrentModuleContextBuffers + (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContex= tBuffers ); ASSERT (!EFI_ERROR (Status) || Status =3D=3D EFI_NOT_FOUND); if (!EFI_ERROR (Status) && CurrentModuleContextBuffers !=3D NULL) { @@ -272,7 +272,7 @@ GatherPrmHandlerInfo ( Status =3D GetContextBuffer ( CurrentHandlerContext.Guid, CurrentModuleContextBuffers, - &CurrentContextBuffer + (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer ); if (!EFI_ERROR (Status)) { CurrentHandlerContext.StaticDataBuffer =3D CurrentContextBuffer-= >StaticDataBuffer; @@ -520,7 +520,7 @@ ParseParameterList ( ) { EFI_STATUS Status; - SHELL_STATUS ReturnStatus; + EFI_STATUS ReturnStatus; UINTN ArgumentCount; EFI_GUID HandlerGuid; BOOLEAN PrintHandlerInfo; diff --git a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c b/PrmPkg/PrmConfigDxe/Prm= ConfigDxe.c index c547db3eca5e..f3223d63de0c 100644 --- a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c +++ b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c @@ -361,10 +361,8 @@ PrmConfigVirtualAddressChangeEvent ( @param[in] Context The pointer to the notification function's= context, which is implementation-dependent. =20 - @retval EFI_SUCCESS The function executed successfully - **/ -EFI_STATUS +VOID EFIAPI PrmConfigEndOfDxeNotification ( IN EFI_EVENT Event, @@ -446,8 +444,6 @@ PrmConfigEndOfDxeNotification ( gBS->FreePool (HandleBuffer); } gBS->CloseEvent(Event); - - return EFI_SUCCESS; } =20 /** @@ -476,7 +472,7 @@ PrmConfigEntryPoint ( // Register a notification function to change memory attributes at end= of DXE // Event =3D NULL; - Status =3D gBS->CreateEventEx( + Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, PrmConfigEndOfDxeNotification, diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c b/PrmPkg/PrmLoaderDxe/Prm= LoaderDxe.c index 407c48257432..aa7aab391e8c 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c @@ -151,7 +151,7 @@ ProcessPrmModules ( Status =3D GetModuleContextBuffers ( ByModuleGuid, &CurrentModuleInfoStruct->Identifier, - &CurrentModuleContextBuffers + (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContex= tBuffers ); ASSERT (!EFI_ERROR (Status) || Status =3D=3D EFI_NOT_FOUND); if (!EFI_ERROR (Status) && CurrentModuleContextBuffers !=3D NULL) { @@ -177,7 +177,7 @@ ProcessPrmModules ( Status =3D GetContextBuffer ( &CurrentHandlerInfoStruct->Identifier, CurrentModuleContextBuffers, - &CurrentContextBuffer + (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer ); if (!EFI_ERROR (Status)) { CurrentHandlerInfoStruct->StaticDataBuffer =3D (UINT64) (UINTN) = CurrentContextBuffer->StaticDataBuffer; @@ -286,10 +286,8 @@ PublishPrmAcpiTable ( @param[in] Context The pointer to the notificatio= n function's context, which is implementation-depend= ent. =20 - @retval EFI_SUCCESS The function executed successf= ully - **/ -EFI_STATUS +VOID EFIAPI PrmLoaderEndOfDxeNotification ( IN EFI_EVENT Event, @@ -314,8 +312,6 @@ PrmLoaderEndOfDxeNotification ( FreePool (PrmAcpiDescriptionTable); } gBS->CloseEvent (Event); - - return EFI_SUCCESS; } =20 /** --=20 2.28.0.windows.1