]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
Add Missing invocations to VA_END() for VA_START().
[mirror_edk2.git] / Nt32Pkg / FvbServicesRuntimeDxe / FWBlockService.c
index 350672448fa4ed55796fdb4e246528b3848a26c5..67d88c650c264d140cc00abbb4a93d955233a947 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -950,14 +950,10 @@ Returns:
     //\r
     // Check input parameters\r
     //\r
-    if (NumOfLba == 0) {\r
+    if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) {\r
       VA_END (args);\r
       return EFI_INVALID_PARAMETER;\r
     }\r
-\r
-    if ((StartingLba + NumOfLba) > NumOfBlocks) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
   } while (1);\r
 \r
   VA_END (args);\r
@@ -1104,10 +1100,6 @@ Returns:
 \r
 --*/\r
 {\r
-  UINT16  *Ptr;\r
-  UINT16  HeaderLength;\r
-  UINT16  Checksum;\r
-\r
   //\r
   // Verify the header revision, header signature, length\r
   // Length of FvBlock cannot be 2**64-1\r
@@ -1124,26 +1116,10 @@ Returns:
   //\r
   // Verify the header checksum\r
   //\r
-  HeaderLength  = (UINT16) (FwVolHeader->HeaderLength / 2);\r
-  Ptr           = (UINT16 *) FwVolHeader;\r
-  Checksum      = 0;\r
-  while (HeaderLength > 0) {\r
-    Checksum = (UINT16)(Checksum + (*Ptr));\r
-    HeaderLength--;\r
-    Ptr++;\r
-  }\r
-\r
-  if (Checksum != 0) {\r
+  if (CalculateCheckSum16 ((UINT16 *) FwVolHeader, FwVolHeader->HeaderLength) != 0) {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  //\r
-  // PI specification defines the name guid of FV exists in extension header.\r
-  //\r
-  if (FwVolHeader->ExtHeaderOffset == 0) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-  \r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1180,7 +1156,7 @@ Returns:
   UINTN                               NumOfBlocks;\r
   EFI_PEI_HOB_POINTERS                FvHob;\r
 \r
-   //\r
+  //\r
   // Get the DXE services table\r
   //\r
   DxeServices = gDS;\r