Revision: 17474
          http://sourceforge.net/p/edk2/code/17474
Author:   czhang46
Date:     2015-05-20 02:19:17 +0000 (Wed, 20 May 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Qiu Shumin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c
    trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
    trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
    trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.h

Modified: trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c 2015-05-20 02:13:42 UTC 
(rev 17473)
+++ trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.c 2015-05-20 02:19:17 UTC 
(rev 17474)
@@ -33,7 +33,7 @@
   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 @@
 /**
   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,9 +587,14 @@
   EsrtTable->FwResourceCount    = (UINT32)((NonFmpRepositorySize + 
FmpRepositorySize) / sizeof(EFI_SYSTEM_RESOURCE_ENTRY));  
   EsrtTable->FwResourceCountMax = PcdGet32(PcdMaxNonFmpEsrtCacheNum) + 
PcdGet32(PcdMaxFmpEsrtCacheNum);
 
-  CopyMem(EsrtTable + 1, NonFmpEsrtRepository, NonFmpRepositorySize);
-  CopyMem((UINT8 *)(EsrtTable + 1) + NonFmpRepositorySize, FmpEsrtRepository, 
FmpRepositorySize);
+  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 @@
   }
 }
 
+/**
+  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 (

Modified: trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf       2015-05-20 
02:13:42 UTC (rev 17473)
+++ trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtDxe.inf       2015-05-20 
02:19:17 UTC (rev 17474)
@@ -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

Modified: trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c        2015-05-20 
02:13:42 UTC (rev 17473)
+++ trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c        2015-05-20 
02:19:17 UTC (rev 17474)
@@ -174,7 +174,7 @@
       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,9 +393,9 @@
 /**
   Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
 
-  @param[in]    EsrtEntry                Esrt entry to be Init
-  @param[in]    FmpImageInfo        FMP image info descriptor
-  @param[in]   DescriptorVersion    FMP Image info descriptor version
+  @param[in, out]     EsrtEntry            Esrt entry to be Init
+  @param[in]          FmpImageInfo         FMP image info descriptor
+  @param[in]          DescriptorVersion    FMP Image info descriptor version
   
 **/
 VOID 

Modified: trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.h
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.h        2015-05-20 
02:13:42 UTC (rev 17473)
+++ trunk/edk2/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.h        2015-05-20 
02:19:17 UTC (rev 17474)
@@ -137,9 +137,9 @@
 /**
   Init one ESRT entry according to input FmpImageInfo (V1, V2, V3) .
 
-  @param[in]    EsrtEntry                Esrt entry to be Init
-  @param[in]    FmpImageInfo        FMP image info descriptor
-  @param[in]   DescriptorVersion    FMP Image info descriptor version
+  @param[in, out]    EsrtEntry             Esrt entry to be Init
+  @param[in]         FmpImageInfo          FMP image info descriptor
+  @param[in]         DescriptorVersion     FMP Image info descriptor version
   
 **/
 VOID 
@@ -153,7 +153,7 @@
   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 @@
 /**
   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


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to