summaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorDetlef Bardtholdt <bardtholdt.detlef@ng-litef.de>2009-06-08 09:34:55 +0200
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-08 09:37:12 +0100
commite4d5eea6414093fb074b19585cb8bebadc2d3e0e (patch)
tree70af260d2aa687825a776fc5f80d208b6f965a84 /ubi-utils
parentc94247b97eac8c1b47bd20b3cb1551f9d3e08e68 (diff)
libubi: fix wrong size calculation with sizes > 4GiB
This fixes the handling of total_bytes, avail_bytes and rsvd_bytes. The result of the multiplication must be 64 Bit. Signed-off-by: Detlef Bardtholdt <bardtholdt.detlef@ng-litef.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/src/libubi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index a4313ab..fd97774 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -1109,8 +1109,8 @@ int ubi_get_dev_info1(libubi_t desc, int dev_num, struct ubi_dev_info *info)
if (dev_read_int(lib->dev_min_io_size, dev_num, &info->min_io_size))
return -1;
- info->avail_bytes = info->avail_lebs * info->leb_size;
- info->total_bytes = info->total_lebs * info->leb_size;
+ info->avail_bytes = (long long)info->avail_lebs * info->leb_size;
+ info->total_bytes = (long long)info->total_lebs * info->leb_size;
return 0;
@@ -1185,7 +1185,7 @@ int ubi_get_vol_info1(libubi_t desc, int dev_num, int vol_id,
&info->corrupted);
if (ret)
return -1;
- info->rsvd_bytes = info->leb_size * info->rsvd_lebs;
+ info->rsvd_bytes = (long long)info->leb_size * info->rsvd_lebs;
ret = vol_read_data(lib->vol_name, dev_num, vol_id, &info->name,
UBI_VOL_NAME_MAX + 2);