MdeModulePkg: Update coding style

Update to follow Tiano Coding style. Fix potential NULL memory copy

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17474 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Chao Zhang 2015-05-20 02:19:17 +00:00 committed by czhang46
parent 037e66befd
commit a3ac258751
4 changed files with 31 additions and 15 deletions

View File

@ -33,7 +33,7 @@ ESRT_MANAGEMENT_PROTOCOL mEsrtManagementProtocolTemplate = {
Get ESRT entry from ESRT Cache by FwClass Guid Get ESRT entry from ESRT Cache by FwClass Guid
@param[in] FwClass FwClass of Esrt entry to get @param[in] FwClass FwClass of Esrt entry to get
@param[in out] Entry Esrt entry returned @param[in, out] Entry Esrt entry returned
@retval EFI_SUCCESS The variable saving this Esrt Entry exists. @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
@retval EF_NOT_FOUND No correct variable found. @retval EF_NOT_FOUND No correct variable found.
@ -217,7 +217,7 @@ EsrtDxeRegisterEsrtEntry(
/** /**
This function syn up Cached ESRT with data from FMP instances This function syn up Cached ESRT with data from FMP instances
Function should be called after Connect All in order to locate all FMP protocols Function should be called after Connect All in order to locate all FMP protocols
installed installed.
@retval EFI_SUCCESS Successfully sync cache repository from FMP instances @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
@retval EFI_NOT_FOUND No FMP Instance are found @retval EFI_NOT_FOUND No FMP Instance are found
@ -587,8 +587,13 @@ EsrtReadyToBootEventNotify (
EsrtTable->FwResourceCount = (UINT32)((NonFmpRepositorySize + FmpRepositorySize) / sizeof(EFI_SYSTEM_RESOURCE_ENTRY)); EsrtTable->FwResourceCount = (UINT32)((NonFmpRepositorySize + FmpRepositorySize) / sizeof(EFI_SYSTEM_RESOURCE_ENTRY));
EsrtTable->FwResourceCountMax = PcdGet32(PcdMaxNonFmpEsrtCacheNum) + PcdGet32(PcdMaxFmpEsrtCacheNum); EsrtTable->FwResourceCountMax = PcdGet32(PcdMaxNonFmpEsrtCacheNum) + PcdGet32(PcdMaxFmpEsrtCacheNum);
if (NonFmpRepositorySize != 0 && NonFmpEsrtRepository != NULL) {
CopyMem(EsrtTable + 1, NonFmpEsrtRepository, NonFmpRepositorySize); CopyMem(EsrtTable + 1, NonFmpEsrtRepository, NonFmpRepositorySize);
}
if (FmpRepositorySize != 0 && FmpEsrtRepository != NULL) {
CopyMem((UINT8 *)(EsrtTable + 1) + NonFmpRepositorySize, FmpEsrtRepository, FmpRepositorySize); CopyMem((UINT8 *)(EsrtTable + 1) + NonFmpRepositorySize, FmpEsrtRepository, FmpRepositorySize);
}
// //
// Publish Esrt to system config table // Publish Esrt to system config table
@ -611,7 +616,17 @@ EXIT:
} }
} }
/**
The module Entry Point of the Esrt DXE driver that manages cached ESRT repository
& publishes ESRT table
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval Other Some error occurs when executing this entry point.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EsrtDxeEntryPoint ( EsrtDxeEntryPoint (

View File

@ -30,6 +30,7 @@
# #
[Sources] [Sources]
EsrtImpl.h
EsrtImpl.c EsrtImpl.c
EsrtDxe.c EsrtDxe.c
@ -50,8 +51,8 @@
PrintLib PrintLib
[Guids] [Guids]
gEfiSystemResourceTableGuid ## PRODUCES gEfiSystemResourceTableGuid ## PRODUCES ## SystemTable
gEfiEventReadyToBootGuid ## CONSUMES gEfiEventReadyToBootGuid ## CONSUMES ## Event
[Protocols] [Protocols]
gEfiFirmwareManagementProtocolGuid ## SOMETIMES_CONSUMES gEfiFirmwareManagementProtocolGuid ## SOMETIMES_CONSUMES

View File

@ -174,7 +174,7 @@ InsertEsrtEntry(
goto EXIT; goto EXIT;
} }
if (RepositorySize != 0) { if (RepositorySize != 0 && EsrtRepository != NULL) {
CopyMem(EsrtRepositoryNew, EsrtRepository, RepositorySize); CopyMem(EsrtRepositoryNew, EsrtRepository, RepositorySize);
} }
CopyMem((UINT8 *)EsrtRepositoryNew + RepositorySize, Entry, sizeof(EFI_SYSTEM_RESOURCE_ENTRY)); CopyMem((UINT8 *)EsrtRepositoryNew + RepositorySize, Entry, sizeof(EFI_SYSTEM_RESOURCE_ENTRY));
@ -393,7 +393,7 @@ EXIT:
/** /**
Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) . Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
@param[in] EsrtEntry Esrt entry to be Init @param[in, out] EsrtEntry Esrt entry to be Init
@param[in] FmpImageInfo FMP image info descriptor @param[in] FmpImageInfo FMP image info descriptor
@param[in] DescriptorVersion FMP Image info descriptor version @param[in] DescriptorVersion FMP Image info descriptor version

View File

@ -137,7 +137,7 @@ UpdateEsrtEntry(
/** /**
Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) . Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
@param[in] EsrtEntry Esrt entry to be Init @param[in, out] EsrtEntry Esrt entry to be Init
@param[in] FmpImageInfo FMP image info descriptor @param[in] FmpImageInfo FMP image info descriptor
@param[in] DescriptorVersion FMP Image info descriptor version @param[in] DescriptorVersion FMP Image info descriptor version
@ -153,7 +153,7 @@ SetEsrtEntryFromFmpInfo (
Get ESRT entry from ESRT Cache by FwClass Guid Get ESRT entry from ESRT Cache by FwClass Guid
@param[in] FwClass FwClass of Esrt entry to get @param[in] FwClass FwClass of Esrt entry to get
@param[in out] Entry Esrt entry returned @param[in, out] Entry Esrt entry returned
@retval EFI_SUCCESS The variable saving this Esrt Entry exists. @retval EFI_SUCCESS The variable saving this Esrt Entry exists.
@retval EF_NOT_FOUND No correct variable found. @retval EF_NOT_FOUND No correct variable found.
@ -215,7 +215,7 @@ EsrtDxeRegisterEsrtEntry(
/** /**
This function syn up Cached ESRT with data from FMP instances This function syn up Cached ESRT with data from FMP instances
Function should be called after Connect All in order to locate all FMP protocols Function should be called after Connect All in order to locate all FMP protocols
installed installed.
@retval EFI_SUCCESS Successfully sync cache repository from FMP instances @retval EFI_SUCCESS Successfully sync cache repository from FMP instances
@retval EFI_NOT_FOUND No FMP Instance are found @retval EFI_NOT_FOUND No FMP Instance are found