aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/string_helpers.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 0d25f7aa732c..2b3757f84b3b 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -42,7 +42,7 @@ int string_get_size(u64 size, const enum string_size_units units,
42 [STRING_UNITS_2] = 1024, 42 [STRING_UNITS_2] = 1024,
43 }; 43 };
44 int i, j; 44 int i, j;
45 u64 remainder = 0, sf_cap; 45 u32 remainder = 0, sf_cap;
46 char tmp[8]; 46 char tmp[8];
47 47
48 tmp[0] = '\0'; 48 tmp[0] = '\0';
@@ -59,14 +59,13 @@ int string_get_size(u64 size, const enum string_size_units units,
59 59
60 if (j) { 60 if (j) {
61 remainder *= 1000; 61 remainder *= 1000;
62 do_div(remainder, divisor[units]); 62 remainder /= divisor[units];
63 snprintf(tmp, sizeof(tmp), ".%03lld", 63 snprintf(tmp, sizeof(tmp), ".%03u", remainder);
64 (unsigned long long)remainder);
65 tmp[j+1] = '\0'; 64 tmp[j+1] = '\0';
66 } 65 }
67 } 66 }
68 67
69 snprintf(buf, len, "%lld%s %s", (unsigned long long)size, 68 snprintf(buf, len, "%u%s %s", (u32)size,
70 tmp, units_str[units][i]); 69 tmp, units_str[units][i]);
71 70
72 return 0; 71 return 0;