Commit 77563f3d authored by Gongwei Li's avatar Gongwei Li Committed by Paul Moore
Browse files

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: default avatarGongwei Li <ligongwei@kylinos.cn>
[PM: subject and description tweaks]
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 4f7b54e1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;