1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-27 22:32:31 +02:00

ima-evm-utils: Fix mismatched type checking

Even if imaevm_get_hash_algo() returns an error value of -1, it is
forced to be converted to uint8_t type here, resulting in this error
not being checked by the if condition. This patch fixes this error.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Tianjia Zhang 2020-07-02 22:16:13 +08:00 committed by Mimi Zohar
parent c9e99f0a21
commit fb19ae86db

View File

@ -924,7 +924,7 @@ static int sign_hash_v2(const char *algo, const unsigned char *hash,
hdr->version = (uint8_t) DIGSIG_VERSION_2;
hdr->hash_algo = imaevm_get_hash_algo(algo);
if (hdr->hash_algo == -1) {
if (hdr->hash_algo == (uint8_t)-1) {
log_err("sign_hash_v2: hash algo is unknown: %s\n", algo);
return -1;
}