diff options
Diffstat (limited to 'resize')
-rw-r--r-- | resize/extent.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/resize/extent.c b/resize/extent.c index 2ed7591d..f0fb1e00 100644 --- a/resize/extent.c +++ b/resize/extent.c @@ -167,9 +167,14 @@ __u32 ext2fs_extent_translate(ext2_extent extent, __u32 old_loc) range = 0; else if (old_loc > highval) range = 1; - else + else { range = ((float) (old_loc - lowval)) / (highval - lowval); + if (range > 0.9) + range = 0.9; + if (range < 0.1) + range = 0.1; + } mid = low + ((int) (range * (high-low))); } #endif |