All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, benh@kernel.crashing.org, aik@ozlabs.ru,
	dvaleev@suse.com
Subject: Re: [PATCH SLOF] disk-label: add support for booting from GPT FAT partition
Date: Fri, 19 Jun 2015 18:35:32 +0200	[thread overview]
Message-ID: <20150619183532.762ec775@thh440s> (raw)
In-Reply-To: <874mm5edpu.fsf@linux.vnet.ibm.com>

On Thu, 18 Jun 2015 11:54:13 +0530
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> wrote:

> Thomas Huth <thuth@redhat.com> writes:
> 
> > On Thu, 11 Jun 2015 15:48:49 +0530
> > Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> wrote:
> >
> >> +   block-size * to seek-pos
> >> +   block gpt>part-entry-size l@-le to gpt-part-size
> >> +   block gpt>num-part-entry l@-le dup 0= IF FALSE EXIT THEN
> >> +   1+ 1 ?DO
> >> +      seek-pos 0 seek drop
> >> +      block gpt-part-size read drop
> >
> > Can you be sure that gpt-part-size is only smaller than 4096 bytes
> > here? 
> 
> So the size is usually 128, so this should be fine.
> 
> https://en.wikipedia.org/wiki/GUID_Partition_Table
> 
> Section: GPT header format
> 
> "84 (0x54)	4 bytes	Size of a single partition entry (usually 128)"

Ok, so it should be fine when you have a valid GPT ... however, one
thing I learnt during my past years: Never ever blindly trust data that
you get from an external medium ... it could have been corrupted by
accident or on purpose. So if you want to make your code more robust,
maybe better check gpt>part-entry-size for being in the range of d# 128
to d# 4096 or you might have to debug very strange crashes one day...

 Thomas

      reply	other threads:[~2015-06-19 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 10:18 [PATCH SLOF] disk-label: add support for booting from GPT FAT partition Nikunj A Dadhania
2015-06-17 10:22 ` Thomas Huth
2015-06-17 11:59   ` Nikunj A Dadhania
2015-06-17 12:04     ` Nikunj A Dadhania
2015-06-19 16:27       ` Thomas Huth
2015-06-19 17:47         ` Nikunj A Dadhania
2015-06-18  6:24   ` Nikunj A Dadhania
2015-06-19 16:35     ` Thomas Huth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150619183532.762ec775@thh440s \
    --to=thuth@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=benh@kernel.crashing.org \
    --cc=dvaleev@suse.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=nikunj@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.