Skip to content

Commit 337619e

Browse files
bauermannmimizohar
authored andcommitted
ima: Update MAX_TEMPLATE_NAME_LEN to fit largest reasonable definition
MAX_TEMPLATE_NAME_LEN is used when restoring measurements carried over from a kexec. It should be set to the length of a template containing all fields except for 'd' and 'n', which don't need to be accounted for since they shouldn't be defined in the same template description as 'd-ng' and 'n-ng'. That length is greater than the current 15, so update using a sizeof() to show where the number comes from and also can be visually shown to be correct. The sizeof() is calculated at compile time. Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 6a31fcd commit 337619e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎security/integrity/ima/ima_template.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ static const struct ima_template_field supported_fields[] = {
4747
{.field_id = "buf", .field_init = ima_eventbuf_init,
4848
.field_show = ima_show_template_buf},
4949
};
50-
#define MAX_TEMPLATE_NAME_LEN 15
50+
51+
/*
52+
* Used when restoring measurements carried over from a kexec. 'd' and 'n' don't
53+
* need to be accounted for since they shouldn't be defined in the same template
54+
* description as 'd-ng' and 'n-ng' respectively.
55+
*/
56+
#define MAX_TEMPLATE_NAME_LEN sizeof("d-ng|n-ng|sig|buf")
5157

5258
static struct ima_template_desc *ima_template;
5359

0 commit comments

Comments
 (0)