Use kvzalloc to make your code better

Use kvzalloc to make your code better
This commit is contained in:
li Insects Awaken 2020-01-22 22:20:55 +08:00 committed by GitHub
parent d96d875ef5
commit af9af4a84f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1173,11 +1173,10 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
if (sz < sizeof(*info) || sz >= XT_MAX_TABLE_SIZE) if (sz < sizeof(*info) || sz >= XT_MAX_TABLE_SIZE)
return NULL; return NULL;
info = kvmalloc(sz, GFP_KERNEL_ACCOUNT); info = kvzalloc(sz, GFP_KERNEL_ACCOUNT);
if (!info) if (!info)
return NULL; return NULL;
memset(info, 0, sizeof(*info));
info->size = size; info->size = size;
return info; return info;
} }