[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d349d22d37041c1a2942d8ed4c76b69@AcuMS.aculab.com>
Date: Thu, 13 Sep 2018 13:06:13 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Karel Zak' <kzak@...hat.com>,
Eugene Korenevsky <ekorenevsky@...il.com>,
Davidlohr Bueso <dave@...olabs.net>,
"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: RE: [PATCH v2] efi: take size of partition entry from GPT header
From: Karel Zak
> Sent: 12 September 2018 09:39
> On Tue, Sep 11, 2018 at 07:15:27PM +0300, Eugene Korenevsky wrote:
> > +static gpt_entry *get_gpt_entry(gpt_header *gpt_hdr, gpt_entry *ptes, u32 index)
> > +{
> > + return (gpt_entry *)((u8 *)ptes + gpt->sizeof_partition_entry * index);
>
> I guess header use LE, so you need:
>
> le32_to_cpu(gpt_hdr->sizeof_partition_entry)
I suspect you also need a sanity check that the value isn't too small
or stupidly large.
In principle slightly short lengths presumably imply that the disk
was formatted with an older standard - so the last fields should be
ignored.
They may not be any such disks - until the on-disk structure is extended
and the kernel structure updated to match.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists