summaryrefslogtreecommitdiff
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-09-30 23:21:11 +0100
committerMark Brown <broonie@kernel.org>2015-09-30 23:21:11 +0100
commit5c0e869357454c2aab3d02d002ffc1f0a0ab2782 (patch)
treede3bf0f70d24fc33d791f776513593da5217ea08 /lib/string_helpers.c
parentbaafd373e9287f20ca0c9a6bb38eb6785a146ac2 (diff)
parented14ee0eea8b6808025356cecc87a8007885263f (diff)
Merge tag 'asoc-fix-v4.3-rc2' into asoc-pxa
ASoC: Fixes for v4.3 A disappointingly large set of fixes, though none of them very big and very widely spread over many different drivers. Nothing especially stands out, it's mostly all device specific and relatively minor.
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++;