diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-09-18 09:24:01 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-09-18 09:24:01 +0200 |
commit | 02386c356af0ce5bbee11ed9b23c312ca60298f0 (patch) | |
tree | 24d6816d783975cbc237af3a53c34f44fda03de2 /lib | |
parent | Merge branch 'perf/urgent' into perf/core, to resolve a conflict (diff) | |
parent | perf: Fix races in computing the header sizes (diff) | |
download | linux-02386c356af0ce5bbee11ed9b23c312ca60298f0.tar.xz linux-02386c356af0ce5bbee11ed9b23c312ca60298f0.zip |
Merge branch 'perf/urgent' into perf/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.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, } 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++; |