[Devel] [PATCH rh7] vznetstat: Use kzalloc instead of kmalloc plus memset

Cyrill Gorcunov gorcunov at virtuozzo.com
Wed Jun 24 00:12:00 PDT 2015


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 kernel/ve/vznetstat/vznetstat.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-pcs7.git/kernel/ve/vznetstat/vznetstat.c
===================================================================
--- linux-pcs7.git.orig/kernel/ve/vznetstat/vznetstat.c
+++ linux-pcs7.git/kernel/ve/vznetstat/vznetstat.c
@@ -220,11 +220,9 @@ struct venet_stat *venet_acct_find_creat
 	}
 	read_unlock(&tc_lock);
 
-	ptr = kmalloc(sizeof(struct venet_stat), GFP_KERNEL);
+	ptr = kzalloc(sizeof(struct venet_stat), GFP_KERNEL);
 	if (ptr == NULL)
 		goto out;
-
-	memset(ptr, 0, sizeof(*ptr));
 	ptr->veid = veid;
 
 	ptr->ipv4_stat = alloc_percpu(struct acct_stat);



More information about the Devel mailing list