Add some fixes and workarounds for gcc-11 static analyzer.

Not everything is a real bug (false positive rate is very high here),
but the code is actually more readable.
This commit is contained in:
Milan Broz
2021-05-18 16:19:08 +02:00
parent 351d7fefca
commit 413b484774
4 changed files with 17 additions and 1 deletions

View File

@@ -2296,8 +2296,13 @@ static int _dm_target_query_verity(struct crypt_device *cd,
str = strsep(&params, " ");
if (!str)
goto err;
if (!root_hash_sig_key_desc)
if (!root_hash_sig_key_desc) {
root_hash_sig_key_desc = strdup(str);
if (!root_hash_sig_key_desc) {
r = -ENOMEM;
goto err;
}
}
i++;
if (vp)
vp->flags |= CRYPT_VERITY_ROOT_HASH_SIGNATURE;