]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix affs/super.c
authorAndries E. Brouwer <andries.brouwer@cwi.nl>
Mon, 17 Mar 2003 00:21:10 +0000 (16:21 -0800)
committerChristoph Hellwig <hch@sgi.com>
Mon, 17 Mar 2003 00:21:10 +0000 (16:21 -0800)
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.

fs/affs/super.c
include/linux/amigaffs.h

index c0608dfef1a47910c43bb32b9fda1293c6f5a9dd..3774983a00fd3fa91b32b85defea974e283e1b07 100644 (file)
@@ -298,7 +298,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*AFFS_SB));
+       memset(sbi, 0, sizeof(struct affs_sb_info));
+
        init_MUTEX(&sbi->s_bmlock);
 
        if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
index bde160f417fd6ca12f6d34f90e95d939a2b95867..6fb6bb5c669669d8a72126197024abdbd4b2038a 100644 (file)
@@ -73,7 +73,7 @@ static inline void
 affs_brelse(struct buffer_head *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);
 }