summaryrefslogtreecommitdiff
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2015-11-24 06:00:02 +0300
committerSimon Horman <horms+renesas@verge.net.au>2015-11-24 06:00:02 +0300
commit998f468f34f41905051556a9897dbc204b1b75b4 (patch)
tree75e402d58ccdcf516daf6a0fa8f54e33cf841787 /lib/string_helpers.c
parentd537543b3948bc3bc9dede248fa455493e055457 (diff)
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
downloadlinux-998f468f34f41905051556a9897dbc204b1b75b4.tar.xz
Merge tag 'v4.4-rc1' into HEAD
Linux 4.4-rc1
Diffstat (limited to 'lib/string_helpers.c')
-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++;