Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\integrity\ima\ima_template.c Create Date:2022-07-28 19:59:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:template_desc_init_fields

Proto:int template_desc_init_fields(const char *template_fmt, const struct ima_template_field ***fields, int *num_fields)

Type:int

Parameter:

TypeParameterName
const char *template_fmt
const struct ima_template_field ***fields
int *num_fields
190  If num_fields && num_fields > 0 Then Return 0
193  template_num_fields = template_fmt_size(template_fmt)
195  If template_num_fields > IMA_TEMPLATE_NUM_FIELDS_MAX Then
196  pr_err("format string '%s' contains too many fields\n", template_fmt)
198  Return -EINVAL
201  When i < template_num_fields cycle
205  len = strchrnul - Find and return a character in a string, or end of string*@s: The string to be searched*@c: The character to search for* Returns pointer to first occurrence of 'c' in s. If c is not found, then - template_fmt_ptr
206  If len == 0 || len > IMA_TEMPLATE_FIELD_ID_MAX_LEN Then
207  pr_err("Invalid field with length %d\n", len)
208  Return -EINVAL
211  memcpy(tmp_field_id, template_fmt_ptr, len)
212  tmp_field_id[len] = '\0'
213  found_fields[i] = lookup_template_field(tmp_field_id)
214  If Not found_fields[i] Then
215  pr_err("field '%s' not found\n", tmp_field_id)
216  Return -ENOENT
220  If fields && num_fields Then
221  fields = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
222  If ( * fields == NULL) Then Return -ENOMEM
225  memcpy( * fields, found_fields, i * size of fields )
226  num_fields = i
229  Return 0
Caller
NameDescribe
ima_parse_rule
ima_template_fmt_setup
ima_init_template
restore_template_fmt
ima_restore_measurement_listRestore the serialized binary measurement list without extending PCRs.