summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-09-18 09:22:55 +0200
committerIngo Molnar <mingo@kernel.org>2015-09-18 09:22:55 +0200
commit0c6a5b4319928b769ba81eff45bd679737a29ba1 (patch)
tree6788dc8dc742445848f07070a3dd73b861f61856 /lib
parent006cdf025a33cb008c3d466bed311c2c347b458f (diff)
parenta7d5c189719846889c029c34e24e166a465368fa (diff)
Merge branch 'linus' into sched/core, to pick up fixes before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/string_helpers.c6
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,
}
exp = divisor[units] / (u32)blk_size;
- if (size >= exp) {
+ /*
+ * size must be strictly greater than exp here to ensure that remainder
+ * is greater than divisor[units] coming out of the if below.
+ */
+ if (size > exp) {
remainder = do_div(size, divisor[units]);
remainder *= blk_size;
i++;