All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] The ending LBA is inclusive. Hence, the partition size should be ((ending-LBA + 1) - starting-LBA) to get the proper partition size.
@ 2008-12-12 15:23 Richard Retanubun
  0 siblings, 0 replies; only message in thread
From: Richard Retanubun @ 2008-12-12 15:23 UTC (permalink / raw)
  To: u-boot

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,

Apologies for the 'custodianship' assumption audacity :)
Let me know if there is a more proper 'channel' for this 
and I'll stop bugging you.

 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-12 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-12 15:23 [PATCH] The ending LBA is inclusive. Hence, the partition size should be ((ending-LBA + 1) - starting-LBA) to get the proper partition size Richard Retanubun

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.