]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
I fixed following bugs.
[mirror_edk2.git] / EdkModulePkg / Universal / Disk / Partition / Dxe / ElTorito.c
index 27beba171b6fd4e129e8076b36c1fb1723d66ecb..88d0c7223d4a3c68427065afe30295ee45f4b534 100644 (file)
@@ -133,7 +133,7 @@ Returns:
     // the 32-bit numerical values is stored in Both-byte orders\r
     //\r
     if (VolDescriptor->Type == CDVOL_TYPE_CODED) {\r
-      VolSpaceSize = VolDescriptor->VolSpaceSize[1];\r
+      VolSpaceSize = VolDescriptor->VolSpaceSize[0];\r
     }\r
     //\r
     // Is it an El Torito volume descriptor?\r
@@ -242,7 +242,14 @@ Returns:
       BootEntry++;\r
       CdDev.PartitionStart = Catalog->Boot.Lba;\r
       if (SectorCount < 2) {\r
-        CdDev.PartitionSize = VolSpaceSize;\r
+        //\r
+        // When the SectorCount < 2, set the Partition as the whole CD.\r
+        //\r
+        if (VolSpaceSize > (Media->LastBlock + 1)) {\r
+          CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1);\r
+        } else {\r
+          CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);\r
+        }\r
       } else {\r
         CdDev.PartitionSize = DivU64x32 (\r
                                 MultU64x32 (\r