mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 18:14:07 +08:00
module: Use vzalloc() instead of vmalloc()/memset(0)
Use vzalloc() instead of vmalloc() and memset(0) to simpify the code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This commit is contained in:
parent
87c482bdfa
commit
2b9401e90d
@ -2138,7 +2138,7 @@ static int move_module(struct module *mod, struct load_info *info)
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
|
#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
|
||||||
/* Do the allocs. */
|
/* Do the allocs. */
|
||||||
ptr = vmalloc(mod->data_layout.size);
|
ptr = vzalloc(mod->data_layout.size);
|
||||||
/*
|
/*
|
||||||
* The pointer to this block is stored in the module structure
|
* The pointer to this block is stored in the module structure
|
||||||
* which is inside the block. Just mark it as not being a
|
* which is inside the block. Just mark it as not being a
|
||||||
@ -2151,7 +2151,6 @@ static int move_module(struct module *mod, struct load_info *info)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ptr, 0, mod->data_layout.size);
|
|
||||||
mod->data_layout.base = ptr;
|
mod->data_layout.base = ptr;
|
||||||
#endif
|
#endif
|
||||||
/* Transfer each section which specifies SHF_ALLOC */
|
/* Transfer each section which specifies SHF_ALLOC */
|
||||||
|
Loading…
Reference in New Issue
Block a user