summaryrefslogtreecommitdiff
path: root/security/integrity/ima/ima_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/integrity/ima/ima_template.c')
-rw-r--r--security/integrity/ima/ima_template.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 04c49f05cb74..7034573fb41e 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -245,7 +245,7 @@ int template_desc_init_fields(const char *template_fmt,
}
if (fields && num_fields) {
- *fields = kmalloc_array(i, sizeof(**fields), GFP_KERNEL);
+ *fields = kmalloc_objs(**fields, i);
if (*fields == NULL)
return -ENOMEM;
@@ -334,7 +334,7 @@ static struct ima_template_desc *restore_template_fmt(char *template_name)
goto out;
}
- template_desc = kzalloc(sizeof(*template_desc), GFP_KERNEL);
+ template_desc = kzalloc_obj(*template_desc);
if (!template_desc)
goto out;
@@ -362,13 +362,14 @@ static int ima_restore_template_data(struct ima_template_desc *template_desc,
int ret = 0;
int i;
- *entry = kzalloc(struct_size(*entry, template_data,
- template_desc->num_fields), GFP_NOFS);
+ *entry = kzalloc_flex(**entry, template_data, template_desc->num_fields,
+ GFP_NOFS);
if (!*entry)
return -ENOMEM;
- digests = kcalloc(NR_BANKS(ima_tpm_chip) + ima_extra_slots,
- sizeof(*digests), GFP_NOFS);
+ digests = kzalloc_objs(*digests,
+ NR_BANKS(ima_tpm_chip) + ima_extra_slots,
+ GFP_NOFS);
if (!digests) {
kfree(*entry);
return -ENOMEM;