diff options
author | Vladimir Serbinenko <phcoder@gmail.com> | 2012-07-30 17:42:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:19 -0400 |
commit | 6ed6a722f9abac25b0549e7507a2b745ede4475c (patch) | |
tree | e4abd14e4d767d37010df501e0941fd826590522 /fs/minix | |
parent | 8dccaf0607b3e047680952d0baf4da0486fbbcc1 (diff) |
minixfs: fix block limit check
On minix2 and minix3 usually max_size is 7fffffff and the check in
question prohibits creation of last block spanning right before 7fffffff,
due to downward rounding during the division. Fix it by using
multiplication instead.
[akpm@linux-foundation.org: fix up code layout, use local `sb']
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/minix')
-rw-r--r-- | fs/minix/itree_v2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c index 13487ad16894..78e2d93e5c83 100644 --- a/fs/minix/itree_v2.c +++ b/fs/minix/itree_v2.c | |||
@@ -32,7 +32,8 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
32 | if (block < 0) { | 32 | if (block < 0) { |
33 | printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", | 33 | printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", |
34 | block, bdevname(sb->s_bdev, b)); | 34 | block, bdevname(sb->s_bdev, b)); |
35 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) { | 35 | } else if ((u64)block * (u64)sb->s_blocksize >= |
36 | minix_sb(sb)->s_max_size) { | ||
36 | if (printk_ratelimit()) | 37 | if (printk_ratelimit()) |
37 | printk("MINIX-fs: block_to_path: " | 38 | printk("MINIX-fs: block_to_path: " |
38 | "block %ld too big on dev %s\n", | 39 | "block %ld too big on dev %s\n", |