Commit e54f721e authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Christoph Hellwig

[PATCH] fix affs/super.c

Mounting a non-affs filesystem as affs crashes the kernel.
The reason is the
	sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
	memset(sbi, 0, sizeof(*AFFS_SB));
where the second sizeof is 1, so that sbi is not zeroed at all.

Also, avoid a warning for printk of sector_t in amigaffs.h.
parent e22feb18
...@@ -298,7 +298,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -298,7 +298,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
if (!sbi) if (!sbi)
return -ENOMEM; return -ENOMEM;
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
memset(sbi, 0, sizeof(*AFFS_SB)); memset(sbi, 0, sizeof(struct affs_sb_info));
init_MUTEX(&sbi->s_bmlock); init_MUTEX(&sbi->s_bmlock);
if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
......
...@@ -73,7 +73,7 @@ static inline void ...@@ -73,7 +73,7 @@ static inline void
affs_brelse(struct buffer_head *bh) affs_brelse(struct buffer_head *bh)
{ {
if (bh) if (bh)
pr_debug("affs_brelse: %ld\n", bh->b_blocknr); pr_debug("affs_brelse: %lld\n", (long long) bh->b_blocknr);
brelse(bh); brelse(bh);
} }
......
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