summaryrefslogtreecommitdiff
path: root/fs/affs
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2006-06-25 05:49:08 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:22 -0700
commit2b943cf09d75c0dfbfd22548988df48f6c24c727 (patch)
tree094e247b677c8b285570063ebf4c352a9875bddf /fs/affs
parentf82ccdb992d694f46b28f0478f62468260f45607 (diff)
downloadkernel-common-2b943cf09d75c0dfbfd22548988df48f6c24c727.tar.gz
kernel-common-2b943cf09d75c0dfbfd22548988df48f6c24c727.tar.bz2
kernel-common-2b943cf09d75c0dfbfd22548988df48f6c24c727.zip
[PATCH] fix %s in affs_fill_super()
%s is only valid if array is known to contain NUL or precision is given and does not exceed the size of array. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/affs')
-rw-r--r--fs/affs/super.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 8765cba35bb9..5200f4938df0 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -271,6 +271,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
int reserved;
unsigned long mount_flags;
int tmp_flags; /* fix remount prototype... */
+ u8 sig[4];
pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options");
@@ -370,8 +371,9 @@ got_root:
printk(KERN_ERR "AFFS: Cannot read boot block\n");
goto out_error;
}
- chksum = be32_to_cpu(*(__be32 *)boot_bh->b_data);
+ memcpy(sig, boot_bh->b_data, 4);
brelse(boot_bh);
+ chksum = be32_to_cpu(*(__be32 *)sig);
/* Dircache filesystems are compatible with non-dircache ones
* when reading. As long as they aren't supported, writing is
@@ -420,11 +422,11 @@ got_root:
}
if (mount_flags & SF_VERBOSE) {
- chksum = cpu_to_be32(chksum);
- printk(KERN_NOTICE "AFFS: Mounting volume \"%*s\": Type=%.3s\\%c, Blocksize=%d\n",
- AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0],
+ u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0];
+ printk(KERN_NOTICE "AFFS: Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n",
+ len > 31 ? 31 : len,
AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1,
- (char *)&chksum,((char *)&chksum)[3] + '0',blocksize);
+ sig, sig[3] + '0', blocksize);
}
sb->s_flags |= MS_NODEV | MS_NOSUID;