linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0)
@ 2022-07-04 12:03 Yang Yingliang
  2022-07-04 14:45 ` Aaron Tomlin
  2022-07-11 16:09 ` Luis Chamberlain
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-07-04 12:03 UTC (permalink / raw)
  To: linux-kernel, linux-modules; +Cc: mcgrof

Use vzalloc() instead of vmalloc() and memset(0) to simpify the code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 kernel/module/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index fed58d30725d..02b67abc448f 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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0)
  2022-07-04 12:03 [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0) Yang Yingliang
@ 2022-07-04 14:45 ` Aaron Tomlin
  2022-07-11 16:09 ` Luis Chamberlain
  1 sibling, 0 replies; 3+ messages in thread
From: Aaron Tomlin @ 2022-07-04 14:45 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-modules, mcgrof

On Mon 2022-07-04 20:03 +0800, Yang Yingliang wrote:
> Use vzalloc() instead of vmalloc() and memset(0) to simpify the code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  kernel/module/main.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index fed58d30725d..02b67abc448f 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 */
> -- 
> 2.25.1
> 

Hi Yang,

Nice!

Reviewed-by: Aaron Tomlin <atomlin@redhat.com>


Kind regards,

-- 
Aaron Tomlin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0)
  2022-07-04 12:03 [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0) Yang Yingliang
  2022-07-04 14:45 ` Aaron Tomlin
@ 2022-07-11 16:09 ` Luis Chamberlain
  1 sibling, 0 replies; 3+ messages in thread
From: Luis Chamberlain @ 2022-07-11 16:09 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-modules

On Mon, Jul 04, 2022 at 08:03:37PM +0800, Yang Yingliang wrote:
> Use vzalloc() instead of vmalloc() and memset(0) to simpify the code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Thanks! Queued onto modules-next.

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-11 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 12:03 [PATCH -next] module: Use vzalloc() instead of vmalloc()/memset(0) Yang Yingliang
2022-07-04 14:45 ` Aaron Tomlin
2022-07-11 16:09 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).