mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 17:46:15 +07:00
ima: simplify conditional statement to improve performance
Precede bit testing before string comparison makes code faster. Also refactor statement as a single line pointer assignment. Logic is following: we set 'xattr_ptr' to read xattr value when we will do appraisal or in any case when measurement template is other than 'ima'. Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:
parent
65d98f3be2
commit
f68c05f4d2
@ -206,10 +206,8 @@ static int process_measurement(struct file *file, const char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template_desc = ima_template_desc_current();
|
template_desc = ima_template_desc_current();
|
||||||
if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) {
|
if ((action & IMA_APPRAISE_SUBMASK) ||
|
||||||
if (action & IMA_APPRAISE_SUBMASK)
|
strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) != 0)
|
||||||
xattr_ptr = &xattr_value;
|
|
||||||
} else
|
|
||||||
xattr_ptr = &xattr_value;
|
xattr_ptr = &xattr_value;
|
||||||
|
|
||||||
rc = ima_collect_measurement(iint, file, xattr_ptr, &xattr_len);
|
rc = ima_collect_measurement(iint, file, xattr_ptr, &xattr_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user