All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] part_efi: Fix partition size calculation due to inclusive ending LBA.
Date: Fri, 23 Jan 2009 08:35:25 -0500	[thread overview]
Message-ID: <4979C79D.3000305@RuggedCom.com> (raw)
In-Reply-To: <4962841D.2030401@RuggedCom.com>

Ping. checking for feedback on this patch, thanks.
> This patch fixed an off-by-one bug found for GPT. Because the ending LBA is inclusive, 
> the partition size should be ((ending_lba + 1) - starting-LBA).
>
> This is confirmed against the results from the parted tool.
> (e.g. use parted /dev/sda -s unit S print) and observe the size.
>
> Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
> ---
> Hi Wolfgang,
>
> I sent this patch in december 12 to u-boot at lists.denx.de but I don't see it 
> in the mailing list (possibly because I botched the commit message).
>
>  disk/part_efi.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/disk/part_efi.c b/disk/part_efi.c
> index cc188ee..d8a8111 100644
> --- a/disk/part_efi.c
> +++ b/disk/part_efi.c
> @@ -163,7 +163,9 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
>
>         /* The ulong casting limits the maximum disk size to 2 TB */
>         info->start = (ulong) le64_to_int((*pgpt_pte)[part - 1].starting_lba);
> -       info->size = (ulong) le64_to_int((*pgpt_pte)[part - 1].ending_lba) - info->start;
> +       /* The ending LBA is inclusive, to calculate size, add 1 to it */
> +       info->size = ((ulong)le64_to_int((*pgpt_pte)[part - 1].ending_lba) + 1)
> +                    - info->start;
>         info->blksz = GPT_BLOCK_SIZE;
>
>         sprintf((char *)info->name, "%s%d\n", GPT_ENTRY_NAME, part);
> --
> 1.5.6.5
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>   

  reply	other threads:[~2009-01-23 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 22:05 [U-Boot] [PATCH] part_efi: Fix partition size calculation due to inclusive ending LBA Richard Retanubun
2009-01-23 13:35 ` Richard Retanubun [this message]
2009-01-26 13:45   ` [U-Boot] [PATCH] [REBASED] " Richard Retanubun
2009-01-27 22:04     ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2008-12-12 15:44 [U-Boot] [PATCH] " Richard Retanubun
2009-01-24  0:34 ` Wolfgang Denk

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=4979C79D.3000305@RuggedCom.com \
    --to=richardretanubun@ruggedcom.com \
    --cc=u-boot@lists.denx.de \
    /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.