[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc bug causes parted to write bad GPT entries

From: Richard Hirst
Subject: Re: gcc bug causes parted to write bad GPT entries
Date: Mon, 18 Mar 2002 22:04:40 +0000
User-agent: Mutt/1.3.24i

On Mon, Mar 18, 2002 at 05:43:12PM +0000, Richard Hirst wrote:
> > If you'd like to make either patch, I'd be happy for it. :-)

This code would never have worked on a big-endian CPU anyway - it does
all it's crc checks _after_ byteswapping the various fields in the
header and table entries to local cpu byte order, and generates before
switching back to LE byte order.

Is anyone playing with GPT on big-endian anywhere?  If so, fixing this
is going to cause them some pain.

I propose that gpt_read_header() and gpt_read_part_entries() grow an
extra parameter, uint32_t *crc, and that they calculate their crc before
byte swapping, returning the value in *crc.  gpt_read_header() will have
to zero the crc in the header before calculating, and restore
afterwards.  Writing out new headsers/tables is messier;
gpt_update_headers() is supposed to recalculate all CRCs, but it is
called before byteswapping cpu_to_le.  A new
gpt_write_header_and_tables() function that byteswaps, does the CRCs,
and then writes the various fields in the right order might be the


reply via email to

[Prev in Thread] Current Thread [Next in Thread]