|
|
8dc857 |
From 1190dc5b214ce6ba4cbeadbdd599ab3ebb2cbb13 Mon Sep 17 00:00:00 2001
|
|
|
8dc857 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
8dc857 |
Date: Fri, 8 Jun 2012 14:42:45 -0700
|
|
|
8dc857 |
Subject: [PATCH] libparted: Fix endian error with FirstUsableLBA (#829960)
|
|
|
8dc857 |
|
|
|
8dc857 |
On big-endial systems (eg. ppc64) this would cause parted to
|
|
|
8dc857 |
crash.
|
|
|
8dc857 |
|
|
|
8dc857 |
* NEWS: add new bugfix
|
|
|
8dc857 |
* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
|
|
|
8dc857 |
fix endian issues with pth->FirstUsableLBA
|
|
|
8dc857 |
---
|
|
|
8dc857 |
NEWS | 3 ++-
|
|
|
8dc857 |
libparted/labels/gpt.c | 4 ++--
|
|
|
8dc857 |
2 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
8dc857 |
|
|
|
8dc857 |
diff --git a/NEWS b/NEWS
|
|
|
8dc857 |
index b0a0657..596ab37 100644
|
|
|
8dc857 |
--- a/NEWS
|
|
|
8dc857 |
+++ b/NEWS
|
|
|
8dc857 |
@@ -1,9 +1,10 @@
|
|
|
8dc857 |
GNU parted NEWS -*- outline -*-
|
|
|
8dc857 |
|
|
|
8dc857 |
-* Noteworthy changes in release 3.1-2 (2012-03-21) [Fedora]
|
|
|
8dc857 |
+* Noteworthy changes in release 3.1-4 (2012-06-08) [Fedora]
|
|
|
8dc857 |
|
|
|
8dc857 |
** Bug Fixes
|
|
|
8dc857 |
|
|
|
8dc857 |
+ libparted: Don't crash on big-endian systems when using GPT
|
|
|
8dc857 |
libparted: Treat disks without a PMBR as msdos labeled disks
|
|
|
8dc857 |
even if they have GPT partition tables.
|
|
|
8dc857 |
|
|
|
8dc857 |
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
|
|
8dc857 |
index ab2145e..6ca33c8 100644
|
|
|
8dc857 |
--- a/libparted/labels/gpt.c
|
|
|
8dc857 |
+++ b/libparted/labels/gpt.c
|
|
|
8dc857 |
@@ -1787,12 +1787,12 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n)
|
|
|
8dc857 |
|
|
|
8dc857 |
if (!_header_is_valid (disk, pth, 1))
|
|
|
8dc857 |
{
|
|
|
8dc857 |
- pth->FirstUsableLBA = 34;
|
|
|
8dc857 |
+ pth->FirstUsableLBA = PED_CPU_TO_LE64 (34);
|
|
|
8dc857 |
pth->SizeOfPartitionEntry
|
|
|
8dc857 |
= PED_CPU_TO_LE32 (sizeof (GuidPartitionEntry_t));
|
|
|
8dc857 |
}
|
|
|
8dc857 |
|
|
|
8dc857 |
- *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2)
|
|
|
8dc857 |
+ *max_n = (disk->dev->sector_size * (PED_LE64_TO_CPU (pth->FirstUsableLBA)-2)
|
|
|
8dc857 |
/ PED_LE32_TO_CPU (pth->SizeOfPartitionEntry));
|
|
|
8dc857 |
pth_free (pth);
|
|
|
8dc857 |
return true;
|
|
|
8dc857 |
--
|
|
|
8dc857 |
1.7.7.6
|
|
|
8dc857 |
|