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

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 24 06:46:25 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.17
------>
commit c2dff4f0b92314830ada8d462fe1e9d31d0f27fc
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Wed Jun 24 17:46:25 2015 +0400

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

diff --git a/kernel/ve/vznetstat/vznetstat.c b/kernel/ve/vznetstat/vznetstat.c
index 2f97b2c..3492fba 100644
--- a/kernel/ve/vznetstat/vznetstat.c
+++ b/kernel/ve/vznetstat/vznetstat.c
@@ -220,11 +220,9 @@ struct venet_stat *venet_acct_find_create_stat(envid_t veid)
 	}
 	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