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
@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 EF_NOT_FOUND No correct variable found.
@ -217,7 +217,7 @@ EsrtDxeRegisterEsrtEntry(
/**
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
installed
installed.
@retval EFI_SUCCESS Successfully sync cache repository from FMP instances
@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->FwResourceCountMax = PcdGet32(PcdMaxNonFmpEsrtCacheNum) + PcdGet32(PcdMaxFmpEsrtCacheNum);
if (NonFmpRepositorySize != 0 && NonFmpEsrtRepository != NULL) {
CopyMem(EsrtTable + 1, NonFmpEsrtRepository, NonFmpRepositorySize);
}
if (FmpRepositorySize != 0 && FmpEsrtRepository != NULL) {
CopyMem((UINT8 *)(EsrtTable + 1) + NonFmpRepositorySize, FmpEsrtRepository, FmpRepositorySize);
}
//
// 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
EFIAPI
EsrtDxeEntryPoint (

View File

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

View File

@ -174,7 +174,7 @@ InsertEsrtEntry(
goto EXIT;
}
if (RepositorySize != 0) {
if (RepositorySize != 0 && EsrtRepository != NULL) {
CopyMem(EsrtRepositoryNew, EsrtRepository, RepositorySize);
}
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) .
@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] DescriptorVersion FMP Image info descriptor version

View File

@ -137,7 +137,7 @@ UpdateEsrtEntry(
/**
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] DescriptorVersion FMP Image info descriptor version
@ -153,7 +153,7 @@ SetEsrtEntryFromFmpInfo (
Get ESRT entry from ESRT Cache by FwClass Guid
@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 EF_NOT_FOUND No correct variable found.
@ -215,7 +215,7 @@ EsrtDxeRegisterEsrtEntry(
/**
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
installed
installed.
@retval EFI_SUCCESS Successfully sync cache repository from FMP instances
@retval EFI_NOT_FOUND No FMP Instance are found