File libparted-gpt-fix-max-partnum-endianness.patch of Package parted.30108
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 8 Jun 2012 13:19:25 +0100
Subject: gpt: fix endianness bug in
gpt_get_max_supported_partition_count
References: bsc#1104667
Patch-mainline: v3.2
Git-commit: 4ac1c02b590668c93afdb48900e0858de58cda3a
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
Take endianness of pth->FirstUsableLBA into account (64-bit,
little endian) when calculating the maximum number of partitions.
Acked-by: Sebastian Parschauer <sparschauer@suse.de>
---
libparted/labels/gpt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1880,12 +1880,12 @@ gpt_get_max_supported_partition_count (c
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;