diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-17 21:16:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-17 21:16:47 -0700 |
commit | a8f155855842f04273666192d3767fa9b94aaa58 (patch) | |
tree | 396180e8db3ac132195feca3f531defaf7d6d3ff /lib/string_helpers.c | |
parent | 8e64a7331702b7888ccf84b2b9ff46ab8e167c7f (diff) | |
parent | 28c553d0aa0acf02e18f9e008661491a4b996595 (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from ANdrew Morton:
"8 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
revert "mm: make sure all file VMAs have ->vm_ops set"
MAINTAINERS: update LTP mailing list
userfaultfd: add missing mmput() in error path
lib/string_helpers.c: fix infinite loop in string_get_size()
alpha: lib: export __delay
alpha: io: define ioremap_uc
kasan: fix last shadow judgement in memory_is_poisoned_16()
zram: fix possible use after free in zcomp_create()
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, } 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++; |