[parted-devel] [PATCH] [resend] Fixed improper data conversion in _parse_header()
Joel Granados
jgranado at redhat.com
Tue Nov 11 14:44:13 UTC 2008
Do you have a test case where the failure is made apparent?
Moreover, look at commit ecea0c9857813beae1c91b0afa39c17634b97a95. Any reason why those other places don't have this change?
----- "Petr Uzel" <petr.uzel at suse.cz> wrote:
> 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
>
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/parted-devel
--
Joel Andres Granados
Red Hat / Brno Czech Republic
More information about the parted-devel
mailing list