From 6ed6a722f9abac25b0549e7507a2b745ede4475c Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 30 Jul 2012 14:42:00 -0700 Subject: 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/minix/itree_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/minix') 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]) if (block < 0) { printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", 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()) printk("MINIX-fs: block_to_path: " "block %ld too big on dev %s\n", -- cgit v1.2.3