From 44a957c6079de6bf6c40d1782bcea07f9866fd58 Mon Sep 17 00:00:00 2001 From: gdong1 Date: Tue, 1 Nov 2011 09:18:30 +0000 Subject: [PATCH] Enhance drivers for sanity check and coding style alignment. Signed-off-by: gdong1 Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12622 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ModifyAccessPolicy.c | 2 +- .../ModifyIdentityPolicy.c | 28 +++++++++---------- .../UserProfileManagerDxe/UserProfileDelete.c | 1 + .../SecureBootConfigImpl.h | 1 - 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c index 613751e023..d73f77eeec 100644 --- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c +++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c @@ -167,7 +167,7 @@ SaveAccessPolicy ( // // Save access policy. // - if (mUserInfo.AccessPolicyModified && (mUserInfo.AccessPolicyLen > 0)) { + if (mUserInfo.AccessPolicyModified && (mUserInfo.AccessPolicyLen > 0) && (mUserInfo.AccessPolicy != NULL)) { Info = AllocateZeroPool (sizeof (EFI_USER_INFO) + mUserInfo.AccessPolicyLen); if (Info == NULL) { return ; diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c index 2e2d67edfc..eaf53c9678 100644 --- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c +++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c @@ -58,7 +58,7 @@ ProviderAlreadyInPolicy ( /** - Add or delete the user's credential record in the provider. + Add the user's credential record in the provider. @param[in] ProviderGuid Point to credential provider guid. @param[in] User Points to user profile. @@ -157,17 +157,13 @@ DeleteCredentialFromProviders ( /** - Remove the provider in FindIdentity from the user identification information record. + Remove the provider specified by Offset from the new user identification record. - @param[in, out] NewInfo On entry, points to the user information to remove provider. - On return, points to the user information the provider is removed. - @param[in] FindIdentity Point to the user identity policy. - - @retval TRUE The provider is removed successfully. - @retval FALSE Fail to remove the provider. + @param[in] IdentityPolicy Point to user identity item in new identification policy. + @param[in] Offset The item offset in the new identification policy. **/ -BOOLEAN +VOID DeleteProviderFromPolicy ( IN EFI_USER_INFO_IDENTITY_POLICY *IdentityPolicy, IN UINTN Offset @@ -184,7 +180,7 @@ DeleteProviderFromPolicy ( IdentityPolicy->Type = EFI_USER_INFO_IDENTITY_TRUE; IdentityPolicy->Length = sizeof (EFI_USER_INFO_IDENTITY_POLICY); mUserInfo.NewIdentityPolicyLen = IdentityPolicy->Length; - return TRUE; + return ; } DeleteLen = IdentityPolicy->Length + sizeof(EFI_USER_INFO_IDENTITY_POLICY); @@ -196,17 +192,19 @@ DeleteProviderFromPolicy ( CopyMem ((UINT8 *) IdentityPolicy, (UINT8 *) IdentityPolicy + DeleteLen, RemainingLen); } mUserInfo.NewIdentityPolicyLen -= DeleteLen; - - return FALSE; } /** - Update the mUserInfo.NewIdentityPolicy, and UI when 'add option' is pressed. + Add a new provider to the mUserInfo.NewIdentityPolicy. + + It is invoked when 'add option' in UI is pressed. + @param[in] NewGuid Points to the credential provider guid. + **/ VOID - AddProviderToPolicy ( +AddProviderToPolicy ( IN EFI_GUID *NewGuid ) { @@ -489,7 +487,7 @@ SaveIdentityPolicy ( **/ VOID - AddIdentityPolicyItem ( +AddIdentityPolicyItem ( VOID ) { diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c index 3fe403106b..8be302e1cc 100644 --- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c +++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileDelete.c @@ -229,6 +229,7 @@ DeleteUser ( // // Delete the user on the credential providers by its identification policy. // + ASSERT (Info != NULL); DeleteCredentialFromProviders ((UINT8 *)(Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), User); FreePool (Info); diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h index 007b7d8737..ffc4720aea 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h @@ -85,7 +85,6 @@ InstallSecureBootConfigForm ( @param[in, out] PrivateData Points to SecureBoot configuration private data. **/ - VOID UninstallSecureBootConfigForm ( IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData -- 2.39.2