/* Violations are flagged in the measurement list with zero hash values. By extending the PCR with 0xFF's instead of with zeroes, the PCR value is invalidated.  */
void ima_add_violation(struct inode *inode, const unsigned char *filename, const char *op, const char *cause)
/* Violations are flagged in the measurement list with zero hash values. By extending the PCR with 0xFF's instead of with zeroes, the PCR value is invalidated.  */
void ima_add_violation(struct inode *inode, const unsigned char *filename, const char *op, const char *cause)
{
	struct ima_template_entry *entry;
	int violation = 1;
	int result;
	atomic_long_inc(&ima_htable.violations);
	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
	if (!entry) {
		result = -ENOMEM;
		goto err_out;
	}
	memset(&entry->template, 0, sizeof(entry->template));
	strncpy(entry->template.file_name, filename, IMA_EVENT_NAME_LEN_MAX);
	result = ima_store_template(entry, violation, inode);
	if (result < 0)
		kfree(entry);
err_out:
	integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, filename,
			    op, cause, result, 0);
}