lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net/netfilter/x_tables.c: Use kvalloc to make your code better
Date
Use kvzalloc () instead of kvmalloc () and memset

Signed-off-by: lizhe <sensor1010@163.com>
---
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 25524e393349..8d6ffed7d526 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1189,11 +1189,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;
}
--
2.25.1

\
 
 \ /
  Last update: 2021-12-10 04:14    [W:0.026 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site