mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
audit: Use kzalloc() instead of kmalloc()/memset() in audit_krule_to_data()
Replace kmalloc+memset by kzalloc for better readability and simplicity. This addresses the warning below: WARNING: kzalloc should be used for data, instead of kmalloc/memset Signed-off-by: Gongwei Li <ligongwei@kylinos.cn> [PM: subject and description tweaks] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
@@ -638,10 +638,9 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)
|
||||
void *bufp;
|
||||
int i;
|
||||
|
||||
data = kmalloc(struct_size(data, buf, krule->buflen), GFP_KERNEL);
|
||||
data = kzalloc(struct_size(data, buf, krule->buflen), GFP_KERNEL);
|
||||
if (unlikely(!data))
|
||||
return NULL;
|
||||
memset(data, 0, sizeof(*data));
|
||||
|
||||
data->flags = krule->flags | krule->listnr;
|
||||
data->action = krule->action;
|
||||
|
||||
Reference in New Issue
Block a user