summaryrefslogtreecommitdiffstats
path: root/kernel/module
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-07-04 14:03:37 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2022-07-11 19:49:14 +0200
commit2b9401e90d369b5fbb8a62e9034ad97297594475 (patch)
tree0cc38c5bba811c9dc262749c4192be778d129635 /kernel/module
parentmodules: Ensure natural alignment for .altinstructions and __bug_table sections (diff)
downloadlinux-2b9401e90d369b5fbb8a62e9034ad97297594475.tar.xz
linux-2b9401e90d369b5fbb8a62e9034ad97297594475.zip
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 */