diff options
author | Mimi Zohar <zohar@linux.ibm.com> | 2022-01-24 14:26:23 -0500 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2022-02-15 11:52:06 -0500 |
commit | 8c54135e2e6da677291012813a26a5f1b2c8a90a (patch) | |
tree | 7310ad04d4a1c673c8fafa27d187b6ee89e9566b /security/integrity/ima/ima_template_lib.c | |
parent | aae6ccbd826d26730a6fd9bc01884f0a0a9cbb25 (diff) | |
download | linux-stable-8c54135e2e6da677291012813a26a5f1b2c8a90a.tar.gz linux-stable-8c54135e2e6da677291012813a26a5f1b2c8a90a.tar.bz2 linux-stable-8c54135e2e6da677291012813a26a5f1b2c8a90a.zip |
ima: define ima_max_digest_data struct without a flexible array variable
To support larger hash digests in the 'iint' cache, instead of defining
the 'digest' field as the maximum digest size, the 'digest' field was
defined as a flexible array variable. The "ima_digest_data" struct was
wrapped inside a local structure with the maximum digest size. But
before adding the record to the iint cache, memory for the exact digest
size was dynamically allocated.
The original reason for defining the 'digest' field as a flexible array
variable is still valid for the 'iint' cache use case. Instead of
wrapping the 'ima_digest_data' struct in a local structure define
'ima_max_digest_data' struct.
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_template_lib.c')
-rw-r--r-- | security/integrity/ima/ima_template_lib.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c index 5a5d462ab36d..7155d17a3b75 100644 --- a/security/integrity/ima/ima_template_lib.c +++ b/security/integrity/ima/ima_template_lib.c @@ -307,10 +307,7 @@ static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, int ima_eventdigest_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { - struct { - struct ima_digest_data hdr; - char digest[IMA_MAX_DIGEST_SIZE]; - } hash; + struct ima_max_digest_data hash; u8 *cur_digest = NULL; u32 cur_digestsize = 0; struct inode *inode; |