[parted-devel] [PATCH] [resend] Fixed improper data conversion in _parse_header()

Petr Uzel petr.uzel at suse.cz
Wed Nov 5 08:53:46 UTC 2008


Hi,
I've already sent this patch, but there was no response, so I'm
resending it with modified subject. 

It fixes a bug in _parse_header() function that may cause parted to
fail on 73.4 GB disks.

The problem is that last_usable_if_grown and last_usable_min_default
should be both CPU format, but last_usable_if_grown is converted to
LE64.

---
 libparted/labels/gpt.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 13d2e88..5ba4be9 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -675,11 +675,10 @@ _parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt,
    parted invocation.
 */
    
-	last_usable_if_grown 
-		= PED_CPU_TO_LE64 (disk->dev->length - 2 - 
+	last_usable_if_grown = disk->dev->length - 2 - 
 		((PedSector)(PED_LE32_TO_CPU(gpt->NumberOfPartitionEntries)) * 
 		(PedSector)(PED_LE32_TO_CPU(gpt->SizeOfPartitionEntry)) / 
-		disk->dev->sector_size));
+		disk->dev->sector_size);
 
 	last_usable_min_default = disk->dev->length - 2 - 
 		GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / disk->dev->sector_size;
-- 
1.6.0.2


-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          tel: +420 284 028 964
190 00 Prague 9                             fax: +420 284 028 951
Czech Republic                              http://www.suse.cz



More information about the parted-devel mailing list