From af9af4a84f9db7e90984fd31dad61c39f76cdf79 Mon Sep 17 00:00:00 2001 From: li Insects Awaken Date: Wed, 22 Jan 2020 22:20:55 +0800 Subject: [PATCH] Use kvzalloc to make your code better Use kvzalloc to make your code better --- net/netfilter/x_tables.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index ce70c2576bb2..e9d16619f718 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -1173,11 +1173,10 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size) if (sz < sizeof(*info) || sz >= XT_MAX_TABLE_SIZE) return NULL; - info = kvmalloc(sz, GFP_KERNEL_ACCOUNT); + info = kvzalloc(sz, GFP_KERNEL_ACCOUNT); if (!info) return NULL; - memset(info, 0, sizeof(*info)); info->size = size; return info; }