]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
Correct typo in word in DxeCore.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVolBlock / FwVolBlock.c
index 02b8914ff82ea767295775d21a1caea43013332c..27e9f9e0b1147a87c0c5f7bdb1ae0706e5667822 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
   Implementations for Firmware Volume Block protocol.\r
 \r
-  It consumes FV HOBs and creates read-lonly Firmare Volume Block protocol\r
+  It consumes FV HOBs and creates read-only Firmare Volume Block protocol\r
   instances for each of them.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2008, 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
@@ -450,6 +450,9 @@ ProduceFVBProtocolOnBuffer (
   // Get FvHeader alignment\r
   //\r
   FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);\r
+  //\r
+  // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value. \r
+  //\r
   if (FvAlignment < 8) {\r
     FvAlignment = 8;\r
   }\r
@@ -513,6 +516,10 @@ ProduceFVBProtocolOnBuffer (
     // FV does not contains extension header, then produce MEMMAP_DEVICE_PATH\r
     //\r
     FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);\r
+    if (FvbDev->DevicePath == NULL) {\r
+      FreePool (FvbDev);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
     ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.StartingAddress = BaseAddress;\r
     ((FV_MEMMAP_DEVICE_PATH *) FvbDev->DevicePath)->MemMapDevPath.EndingAddress   = BaseAddress + FwVolHeader->FvLength - 1;\r
   } else {\r
@@ -520,6 +527,10 @@ ProduceFVBProtocolOnBuffer (
     // FV contains extension header, then produce MEDIA_FW_VOL_DEVICE_PATH\r
     //\r
     FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);\r
+    if (FvbDev->DevicePath == NULL) {\r
+      FreePool (FvbDev);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
     CopyGuid (\r
       &((FV_PIWG_DEVICE_PATH *)FvbDev->DevicePath)->FvDevPath.FvName, \r
       (GUID *)(UINTN)(BaseAddress + FwVolHeader->ExtHeaderOffset)\r