[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Tue Nov 10 14:20:17 UTC 2009


 libparted/labels/gpt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 97c69934bb8c5fb2fdbe326618034dba79b1cfca
Author: Jim Meyering <meyering at redhat.com>
Date:   Tue Nov 10 15:20:08 2009 +0100

    gpt: fix a bug in the new PE-array CRC checks on big-endian systems
    
    * libparted/labels/gpt.c (check_PE_array_CRC, gpt_read): Always
    convert the PartitionEntryArrayCRC32 to CPU endianness before
    comparing with a just-computed CRC.

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 8b77c51..5037d9b 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -642,7 +642,7 @@ check_PE_array_CRC (PedDisk const *disk,
     return 1;
 
   uint32_t ptes_crc = efi_crc32 (ptes, ptes_bytes);
-  *valid = (ptes_crc == gpt->PartitionEntryArrayCRC32);
+  *valid = (ptes_crc == PED_LE32_TO_CPU (gpt->PartitionEntryArrayCRC32));
   free (ptes);
   return 0;
 }
@@ -1032,7 +1032,7 @@ gpt_read (PedDisk *disk)
     goto error_free_gpt;
 
   uint32_t ptes_crc = efi_crc32 (ptes, ptes_bytes);
-  if (ptes_crc != gpt->PartitionEntryArrayCRC32)
+  if (ptes_crc != PED_LE32_TO_CPU (gpt->PartitionEntryArrayCRC32))
     {
       ped_exception_throw
         (PED_EXCEPTION_ERROR,



More information about the Parted-commits mailing list