diff options
Diffstat (limited to 'lib/string_helpers.c')
-rw-r--r-- | lib/string_helpers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 54036ce2e2dd..5939f63d90cd 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c | |||
@@ -59,7 +59,11 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | exp = divisor[units] / (u32)blk_size; | 61 | exp = divisor[units] / (u32)blk_size; |
62 | if (size >= exp) { | 62 | /* |
63 | * size must be strictly greater than exp here to ensure that remainder | ||
64 | * is greater than divisor[units] coming out of the if below. | ||
65 | */ | ||
66 | if (size > exp) { | ||
63 | remainder = do_div(size, divisor[units]); | 67 | remainder = do_div(size, divisor[units]); |
64 | remainder *= blk_size; | 68 | remainder *= blk_size; |
65 | i++; | 69 | i++; |