summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGongwei Li <ligongwei@kylinos.cn>2025-11-05 18:36:19 +0800
committerPaul Moore <paul@paul-moore.com>2025-11-07 16:38:34 -0500
commit77563f3d4704206c8f6626852365591aa4e0b779 (patch)
tree5fbb29ba2dd6c4bb36a2bef566ba31d9ef8fe757
parent4f7b54e17eddac93c78151ffc80b8437ab11c90b (diff)
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>
-rw-r--r--kernel/auditfilter.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index c401082d9b25..6a86c0683b67 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -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;