[parted/f17] - Fix crash on ppc64 with GPT (#829960) (rwmj)

Brian C. Lane bcl at fedoraproject.org
Fri Jun 8 22:29:10 UTC 2012


commit 68146ddc2f0899981b8f4e503242fb433fb8dafd
Author: Brian C. Lane <bcl at redhat.com>
Date:   Fri Jun 8 15:27:42 2012 -0700

    - Fix crash on ppc64 with GPT (#829960) (rwmj)

 ...rted-Fix-endian-error-with-FirstUsableLBA.patch |   52 ++++++++++++++++++++
 parted.spec                                        |    6 ++-
 2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch b/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch
new file mode 100644
index 0000000..04fd675
--- /dev/null
+++ b/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch
@@ -0,0 +1,52 @@
+From 8fe23da6d435c299a9e8056bd2ac6697315f7357 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Fri, 8 Jun 2012 14:42:45 -0700
+Subject: [PATCH] libparted: Fix endian error with FirstUsableLBA (#829960)
+
+On big-endial systems (eg. ppc64) this would cause parted to
+crash.
+
+* NEWS: add new bugfix
+* libparted/labels/gpt.c (gpt_get_max_supported_partition_count):
+  fix endian issues with pth->FirstUsableLBA
+---
+ NEWS                   |    3 ++-
+ libparted/labels/gpt.c |    4 ++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index ccfec62..55348a9 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,7 +1,8 @@
+ GNU parted NEWS                                    -*- outline -*-
+ 
+-* Noteworthy changes in release 3.0-9 (Fedora)
++* Noteworthy changes in release 3.0-10 (Fedora)
+ 
++  libparted: Don't crash on big-endian systems when using GPT
+   libparted: Treat disks without a PMBR as msdos labeled disks
+   even if they have GPT partition tables.
+ 
+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.7.6
+
diff --git a/parted.spec b/parted.spec
index b2da8d6..aa99dea 100644
--- a/parted.spec
+++ b/parted.spec
@@ -4,7 +4,7 @@
 Summary: The GNU disk partition manipulation program
 Name:    parted
 Version: 3.0
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv3+
 Group:   Applications/System
 URL:     http://www.gnu.org/software/parted
@@ -41,6 +41,7 @@ Patch20: parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch
 Patch21: parted-3.1-libparted-avoid-unwarranted-failed-assertion-during-.patch
 Patch22: parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch
 Patch23: parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch
+Patch24: parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: e2fsprogs-devel
@@ -171,6 +172,9 @@ fi
 
 
 %changelog
+* Fri Jun 08 2012 Brian C. Lane <bcl at redhat.com> 3.0-10
+- Fix crash on ppc64 with GPT (#829960) (rwmj)
+
 * Tue Mar 20 2012 Brian C. Lane <bcl at redhat.com> 3.0-9
 - libparted: check PMBR before GPT partition table (#805272)
 - tests: add a test for the new behavior


More information about the scm-commits mailing list