summaryrefslogtreecommitdiff
path: root/resize/extent.c
diff options
context:
space:
mode:
Diffstat (limited to 'resize/extent.c')
-rw-r--r--resize/extent.c7
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