summaryrefslogtreecommitdiff
path: root/kernel/module
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-07-04 20:03:37 +0800
committerLuis Chamberlain <mcgrof@kernel.org>2022-07-11 10:49:14 -0700
commit2b9401e90d369b5fbb8a62e9034ad97297594475 (patch)
tree0cc38c5bba811c9dc262749c4192be778d129635 /kernel/module
parent87c482bdfa79f378297d92af49cdf265be199df5 (diff)
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>
Diffstat (limited to 'kernel/module')
-rw-r--r--kernel/module/main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index b2de00e09abc..d34227ca3932 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -2138,7 +2138,7 @@ static int move_module(struct module *mod, struct load_info *info)
#ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
/* 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
* 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;
}
- memset(ptr, 0, mod->data_layout.size);
mod->data_layout.base = ptr;
#endif
/* Transfer each section which specifies SHF_ALLOC */