mirror of https://gitee.com/openkylin/linux.git
hostfs: use kmalloc instead of kzalloc
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>
This commit is contained in:
parent
2b3b9bb03a
commit
371fdab100
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue