Commit 6ed6a722 authored by Vladimir Serbinenko's avatar Vladimir Serbinenko Committed by Linus Torvalds

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: default avatarVladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8dccaf06
...@@ -32,7 +32,8 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) ...@@ -32,7 +32,8 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
if (block < 0) { if (block < 0) {
printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
block, bdevname(sb->s_bdev, b)); block, bdevname(sb->s_bdev, b));
} else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) { } else if ((u64)block * (u64)sb->s_blocksize >=
minix_sb(sb)->s_max_size) {
if (printk_ratelimit()) if (printk_ratelimit())
printk("MINIX-fs: block_to_path: " printk("MINIX-fs: block_to_path: "
"block %ld too big on dev %s\n", "block %ld too big on dev %s\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment