\r
\r
/**\r
- Restore Partition Table to its alternate place\r
+ Restore Partition Table to its alternate place.\r
(Primary -> Backup or Backup -> Primary)\r
\r
@param[in] PartHeader Partition table header structure\r
\r
\r
/**\r
- Checks the CRC32 value in the table header\r
+ Checks the CRC32 value in the table header.\r
\r
@param MaxSize Max Size limit\r
@param Size The size of the table\r
\r
\r
/**\r
- Checks the CRC32 value in the table header\r
+ Checks the CRC32 value in the table header.\r
\r
@param MaxSize Max Size limit\r
@param Hdr Table to check\r
\r
\r
/**\r
- Updates the CRC32 value in the table header\r
+ Updates the CRC32 value in the table header.\r
\r
@param Size The size of the table\r
@param Hdr Table to update\r
\r
\r
/**\r
- Updates the CRC32 value in the table header\r
+ Updates the CRC32 value in the table header.\r
\r
@param Hdr Table to update\r
\r
EFI_PARTITION_ENTRY *PartEntry;\r
EFI_PARTITION_ENTRY_STATUS *PEntryStatus;\r
UINTN Index;\r
- EFI_STATUS GptValid;\r
+ EFI_STATUS GptValidStatus;\r
HARDDRIVE_DEVICE_PATH HdDev;\r
\r
ProtectiveMbr = NULL;\r
LastBlock = BlockIo->Media->LastBlock;\r
\r
DEBUG ((EFI_D_INFO, " BlockSize : %d \n", BlockSize));\r
- DEBUG ((EFI_D_INFO, " LastBlock : %x \n", LastBlock));\r
+ DEBUG ((EFI_D_INFO, " LastBlock : %lx \n", LastBlock));\r
\r
- GptValid = EFI_NOT_FOUND;\r
+ GptValidStatus = EFI_NOT_FOUND;\r
\r
//\r
// Allocate a buffer for the Protective MBR\r
ProtectiveMbr\r
);\r
if (EFI_ERROR (Status)) {\r
- GptValid = Status;\r
+ GptValidStatus = Status;\r
goto Done;\r
}\r
//\r
}\r
\r
BackupHeader = AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER));\r
-\r
if (BackupHeader == NULL) {\r
goto Done;\r
}\r
PartEntry\r
);\r
if (EFI_ERROR (Status)) {\r
- GptValid = Status;\r
- DEBUG ((EFI_D_INFO, " Partition Entry ReadBlocks error\n"));\r
+ GptValidStatus = Status;\r
+ DEBUG ((EFI_D_ERROR, " Partition Entry ReadBlocks error\n"));\r
goto Done;\r
}\r
\r
//\r
// If we got this far the GPT layout of the disk is valid and we should return true\r
//\r
- GptValid = EFI_SUCCESS;\r
+ GptValidStatus = EFI_SUCCESS;\r
\r
//\r
// Create child device handles\r
HdDev.PartitionSize = PartEntry[Index].EndingLBA - PartEntry[Index].StartingLBA + 1;\r
CopyMem (HdDev.Signature, &PartEntry[Index].UniquePartitionGUID, sizeof (EFI_GUID));\r
\r
- DEBUG ((EFI_D_INFO, " Index : %d\n", Index));\r
- DEBUG ((EFI_D_INFO, " Start LBA : %x\n", HdDev.PartitionStart));\r
- DEBUG ((EFI_D_INFO, " End LBA : %x\n", PartEntry[Index].EndingLBA));\r
- DEBUG ((EFI_D_INFO, " Partition size: %x\n", HdDev.PartitionSize));\r
- DEBUG ((EFI_D_INFO, " Start : %x", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));\r
- DEBUG ((EFI_D_INFO, " End : %x\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));\r
+ DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));\r
+ DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));\r
+ DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) PartEntry[Index].EndingLBA));\r
+ DEBUG ((EFI_D_INFO, " Partition size: %lx\n", (UINT64) HdDev.PartitionSize));\r
+ DEBUG ((EFI_D_INFO, " Start : %lx", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));\r
+ DEBUG ((EFI_D_INFO, " End : %lx\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));\r
\r
Status = PartitionInstallChildHandle (\r
This,\r
FreePool (PEntryStatus);\r
}\r
\r
- return GptValid;\r
+ return GptValidStatus;\r
}\r
\r
\r
!PartitionCheckCrc (BlockSize, &PartHdr->Header) ||\r
PartHdr->MyLBA != Lba\r
) {\r
- DEBUG ((EFI_D_INFO, " !Valid efi partition table header\n"));\r
+ DEBUG ((EFI_D_INFO, "Invalid efi partition table header\n"));\r
FreePool (PartHdr);\r
return FALSE;\r
}\r
\r
Done:\r
FreePool (PartHdr);\r
- FreePool (Ptr);\r
+\r
+ if (Ptr != NULL) {\r
+ FreePool (Ptr);\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
return FALSE;\r
\r
\r
/**\r
- Restore Partition Table to its alternate place\r
+ Restore Partition Table to its alternate place.\r
(Primary -> Backup or Backup -> Primary)\r
\r
@param[in] PartHeader Partition table header structure\r
\r
\r
/**\r
- Updates the CRC32 value in the table header\r
+ Updates the CRC32 value in the table header.\r
\r
@param Hdr Table to update\r
\r
\r
\r
/**\r
- Updates the CRC32 value in the table header\r
+ Updates the CRC32 value in the table header.\r
\r
@param Size The size of the table\r
@param Hdr Table to update\r
IN UINTN Size,\r
IN OUT EFI_TABLE_HEADER *Hdr\r
)\r
-\r
{\r
UINT32 Crc;\r
\r
\r
\r
/**\r
- Checks the CRC32 value in the table header\r
+ Checks the CRC32 value in the table header.\r
\r
@param MaxSize Max Size limit\r
@param Hdr Table to check\r
\r
\r
/**\r
- Checks the CRC32 value in the table header\r
+ Checks the CRC32 value in the table header.\r
\r
@param MaxSize Max Size limit\r
@param Size The size of the table\r
return FALSE;\r
}\r
\r
- if (MaxSize && Size > MaxSize) {\r
+ if ((MaxSize != 0) && (Size > MaxSize)) {\r
DEBUG ((EFI_D_ERROR, "CheckCrc32: Size > MaxSize\n"));\r
return FALSE;\r
}\r