Skip to content

Commit

Permalink
hostfs: use kmalloc instead of kzalloc
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Hogan <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
James Hogan authored and Al Viro committed May 4, 2013
1 parent 2b3b9bb commit 371fdab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 371fdab

Please sign in to comment.