hostfs: use kmalloc instead of kzalloc
authorJames Hogan <james.hogan@imgtec.com>
Wed, 27 Mar 2013 10:47:14 +0000 (10:47 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 May 2013 19:48:45 +0000 (15:48 -0400)
The inode info structure is zeroed at allocation with kzalloc, and then
all but one of the fields (including the largest, vfs_inode) are
initialised explicitly. Switch to using kmalloc and initialise the
remaining field too.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/hostfs/hostfs_kern.c

index f2372ef80850f879c4b66ab2135b8975d7f85d69..32f35f18798902de1eb9b26d320dfe042cad7ff4 100644 (file)
@@ -228,10 +228,11 @@ static struct inode *hostfs_alloc_inode(struct super_block *sb)
 {
        struct hostfs_inode_info *hi;
 
-       hi = kzalloc(sizeof(*hi), GFP_KERNEL);
+       hi = kmalloc(sizeof(*hi), GFP_KERNEL);
        if (hi == NULL)
                return NULL;
        hi->fd = -1;
+       hi->mode = 0;
        inode_init_once(&hi->vfs_inode);
        return &hi->vfs_inode;
 }