linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc: vmcore - use kzalloc in get_new_element
@ 2009-06-06 17:12 Cyrill Gorcunov
  2009-06-08  1:50 ` Amerigo Wang
  2009-06-08 12:53 ` Vivek Goyal
  0 siblings, 2 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2009-06-06 17:12 UTC (permalink / raw)
  To: LKML; +Cc: Alexey Dobriyan, Vivek Goyal

Instead of kmalloc+memset better use straight kzalloc

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 fs/proc/vmcore.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: linux-2.6.git/fs/proc/vmcore.c
=====================================================================
--- linux-2.6.git.orig/fs/proc/vmcore.c
+++ linux-2.6.git/fs/proc/vmcore.c
@@ -166,12 +166,7 @@ static const struct file_operations proc
 
 static struct vmcore* __init get_new_element(void)
 {
-	struct vmcore *p;
-
-	p = kmalloc(sizeof(*p), GFP_KERNEL);
-	if (p)
-		memset(p, 0, sizeof(*p));
-	return p;
+	return kzalloc(sizeof(struct vmcore), GFP_KERNEL);
 }
 
 static u64 __init get_vmcore_size_elf64(char *elfptr)

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

* Re: [PATCH] proc: vmcore - use kzalloc in get_new_element
  2009-06-06 17:12 [PATCH] proc: vmcore - use kzalloc in get_new_element Cyrill Gorcunov
@ 2009-06-08  1:50 ` Amerigo Wang
  2009-06-08 12:53 ` Vivek Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Amerigo Wang @ 2009-06-08  1:50 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: LKML, Alexey Dobriyan, Vivek Goyal

On Sat, Jun 06, 2009 at 09:12:07PM +0400, Cyrill Gorcunov wrote:
>Instead of kmalloc+memset better use straight kzalloc
>
>Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>

Looks good!

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>


>---
> fs/proc/vmcore.c |    7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
>Index: linux-2.6.git/fs/proc/vmcore.c
>=====================================================================
>--- linux-2.6.git.orig/fs/proc/vmcore.c
>+++ linux-2.6.git/fs/proc/vmcore.c
>@@ -166,12 +166,7 @@ static const struct file_operations proc
> 
> static struct vmcore* __init get_new_element(void)
> {
>-	struct vmcore *p;
>-
>-	p = kmalloc(sizeof(*p), GFP_KERNEL);
>-	if (p)
>-		memset(p, 0, sizeof(*p));
>-	return p;
>+	return kzalloc(sizeof(struct vmcore), GFP_KERNEL);
> }
> 
> static u64 __init get_vmcore_size_elf64(char *elfptr)
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH] proc: vmcore - use kzalloc in get_new_element
  2009-06-06 17:12 [PATCH] proc: vmcore - use kzalloc in get_new_element Cyrill Gorcunov
  2009-06-08  1:50 ` Amerigo Wang
@ 2009-06-08 12:53 ` Vivek Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Vivek Goyal @ 2009-06-08 12:53 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: LKML, Alexey Dobriyan

On Sat, Jun 06, 2009 at 09:12:07PM +0400, Cyrill Gorcunov wrote:
> Instead of kmalloc+memset better use straight kzalloc
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
>  fs/proc/vmcore.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> Index: linux-2.6.git/fs/proc/vmcore.c
> =====================================================================
> --- linux-2.6.git.orig/fs/proc/vmcore.c
> +++ linux-2.6.git/fs/proc/vmcore.c
> @@ -166,12 +166,7 @@ static const struct file_operations proc
>  
>  static struct vmcore* __init get_new_element(void)
>  {
> -	struct vmcore *p;
> -
> -	p = kmalloc(sizeof(*p), GFP_KERNEL);
> -	if (p)
> -		memset(p, 0, sizeof(*p));
> -	return p;
> +	return kzalloc(sizeof(struct vmcore), GFP_KERNEL);
>  }
>  
>  static u64 __init get_vmcore_size_elf64(char *elfptr)

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Thanks
Vivek


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

end of thread, other threads:[~2009-06-08 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-06 17:12 [PATCH] proc: vmcore - use kzalloc in get_new_element Cyrill Gorcunov
2009-06-08  1:50 ` Amerigo Wang
2009-06-08 12:53 ` Vivek Goyal

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).