[parted-devel] [PATCH parted] gpt: Fix endianness issue when using pth->FirstUsableLBA.
Richard W.M. Jones
rjones at redhat.com
Fri Jun 8 12:39:54 UTC 2012
Full explanation is here:
https://bugzilla.redhat.com/show_bug.cgi?id=829960#c6
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
-------------- next part --------------
>From 54bfe3fac90465b2b5150d8d8dac88511b869fd7 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <parted-owner at fedoraproject.org>
Date: Fri, 8 Jun 2012 13:19:25 +0100
Subject: [PATCH] gpt: Fix endianness issue when using pth->FirstUsableLBA.
Signed-off-by: Richard W.M. Jones <rjones at redhat.com>
---
libparted/labels/gpt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 4c72cd2..3c26489 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1792,12 +1792,12 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
if (!_header_is_valid (disk, pth, 1))
{
- pth->FirstUsableLBA = 34;
+ pth->FirstUsableLBA = PED_CPU_TO_LE64 (34);
pth->SizeOfPartitionEntry
= PED_CPU_TO_LE32 (sizeof (GuidPartitionEntry_t));
}
- *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
+ *max_n = (disk->dev->sector_size * (PED_LE64_TO_CPU (pth->FirstUsableLBA)-2)
/ PED_LE32_TO_CPU (pth->SizeOfPartitionEntry));
pth_free (pth);
return true;
--
1.7.10.1
More information about the parted-devel
mailing list