summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPiotr Wilczek <p.wilczek@samsung.com>2013-01-27 22:59:25 +0000
committerTom Rini <trini@ti.com>2013-02-20 08:52:41 -0500
commit3e34cf7bffb87f3a96a87a4d1e0a76df7322b3c1 (patch)
tree39f54d31fe25188dd3b41a228b40690a81bb79cb /common
parentc8876f1c72ac36879436278892e6c20a93174b6a (diff)
downloadu-boot-imx-3e34cf7bffb87f3a96a87a4d1e0a76df7322b3c1.zip
u-boot-imx-3e34cf7bffb87f3a96a87a4d1e0a76df7322b3c1.tar.gz
u-boot-imx-3e34cf7bffb87f3a96a87a4d1e0a76df7322b3c1.tar.bz2
gpt: fix partion size limit
Currently, in gpt command, partion size is converted from string to unsigned long type using 'ustrtol' function. That type limits the partition size to 4GB. This patch changes the conversion function to 'ustrtoll' to return unsigned long long type. Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_gpt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c
index da7705d..efd7934 100644
--- a/common/cmd_gpt.c
+++ b/common/cmd_gpt.c
@@ -27,6 +27,7 @@
#include <part_efi.h>
#include <exports.h>
#include <linux/ctype.h>
+#include <div64.h>
#ifndef CONFIG_PARTITION_UUIDS
#error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_GPT to be enabled
@@ -131,6 +132,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
int p_count;
disk_partition_t *parts;
int errno = 0;
+ uint64_t size_ll, start_ll;
debug("%s: MMC lba num: 0x%x %d\n", __func__,
(unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
@@ -217,8 +219,8 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
}
if (extract_env(val, &p))
p = val;
- parts[i].size = ustrtoul(p, &p, 0);
- parts[i].size /= dev_desc->blksz;
+ size_ll = ustrtoull(p, &p, 0);
+ parts[i].size = lldiv(size_ll, dev_desc->blksz);
free(val);
/* start address */
@@ -226,8 +228,8 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
if (val) { /* start address is optional */
if (extract_env(val, &p))
p = val;
- parts[i].start = ustrtoul(p, &p, 0);
- parts[i].start /= dev_desc->blksz;
+ start_ll = ustrtoull(p, &p, 0);
+ parts[i].start = lldiv(start_ll, dev_desc->blksz);
free(val);
}
}