net/netfilter/x_tables.c: Use kvalloc to make your code better
Subsystems (3)
PATCH 1/1 net/netfilter/x_tables.c: Use kvalloc to make your code better
Use kvzalloc () instead of kvmalloc () and memset
Signed-off-by lizhe <[email protected]>
--- net/netfilter/x_tables.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/x_tables.c +1 -2
@@ -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; }
Signature · 1 line
2.25.1
Florian Westphal
maintainerQuoted 12 lines · lizhe
Use kvzalloc () instead of kvmalloc () and memset
Signed-off-by lizhe <[email protected]>--- net/netfilter/x_tables.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/netfilter/x_tables.c +0
-0
net/netfilter/x_tables.c struct xt_table_info *xt_alloc_table_info(unsigned int size) · line 1196
Quoted 9 lines
net/netfilter/x_tables.c +1
-2@@ -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));
sz != sizeof(*info)