Re: [patch] ext2_fill_super breakage

Brian Gerst
2002-03-28T22:47:13Z

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

Andrew Morton wrote:
> In 2.5.7 there is a thinko in the allocation and initialisation
> of the fs-private superblock for ext2. It's passing the wrong type
> to the sizeof operator (which of course gives the wrong size)
> when allocating and clearing the memory.

Same bug with bfs patch (only in -dj tree so far).

--

Brian Gerst

[-- Attachment #2: sb-bfs-2 --]
[-- Type: text/plain, Size: 533 bytes --]

diff -urN linux-2.5.7-dj2/fs/bfs/inode.c linux/fs/bfs/inode.c
--- linux-2.5.7-dj2/fs/bfs/inode.c Thu Mar 28 16:34:37 2002
+++ linux/fs/bfs/inode.c Thu Mar 28 16:35:43 2002
@@ -292,11 +292,11 @@
int i, imap_len;
struct bfs_sb_info * info;

- info = kmalloc(sizeof(struct bfs_super_block), GFP_KERNEL);
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
s->u.generic_sbp = info;
- memset(info, 0, sizeof(struct bfs_super_block));
+ memset(info, 0, sizeof(*info));

sb_set_blocksize(s, BFS_BSIZE);