From 71a667fbf0fb8be676eaee0e612466eedcac7565 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 23 Jun 2021 13:13:47 +0000 Subject: [PATCH] genprotimg: add missing return values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 65b9fc442c1a ("genprotimg: introduce new tool for the creation of PV images") Reviewed-by: Patrick Steuer Reviewed-by: Bjoern Walk Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- CHANGELOG.md | 1 + genprotimg/src/pv/pv_comp.c | 3 +++ genprotimg/src/utils/crypto.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 385224fc..6e81c35e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Release history for s390-tools (MIT version) Bug Fixes: - dbginfo: add KVM data collection for server and guest - fix lszdev - dbginfo: add /proc/kallsyms - refresh zVM, lscpu - fix WORKARCHIVE handling + - genprotimg: Add missing return values in error paths * __v2.16.0 (2021-02-19)__ diff --git a/genprotimg/src/pv/pv_comp.c b/genprotimg/src/pv/pv_comp.c index 21879ae7..f37210c8 100644 --- a/genprotimg/src/pv/pv_comp.c +++ b/genprotimg/src/pv/pv_comp.c @@ -383,6 +383,7 @@ int64_t pv_component_update_tld(const PvComponent *comp, EVP_MD_CTX *ctx, g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, _("BN_bin2bn failed")); + return -1; } for (uint64_t cur = 0; cur < size; cur += PAGE_SIZE) { @@ -395,6 +396,7 @@ int64_t pv_component_update_tld(const PvComponent *comp, EVP_MD_CTX *ctx, g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, _("BN_bn2binpad failed")); + return -1; } if (EVP_DigestUpdate(ctx, tmp, sizeof(tmp)) != 1) { @@ -409,6 +411,7 @@ int64_t pv_component_update_tld(const PvComponent *comp, EVP_MD_CTX *ctx, g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, _("BN_add_word failed")); + return -1; } nep++; diff --git a/genprotimg/src/utils/crypto.c b/genprotimg/src/utils/crypto.c index 05c3e832..81367b23 100644 --- a/genprotimg/src/utils/crypto.c +++ b/genprotimg/src/utils/crypto.c @@ -1847,6 +1847,7 @@ static gint __encrypt_decrypt_bio(const struct cipher_parms *parms, BIO *b_in, g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, _("BN_add_word failed")); + return -1; } g_assert(BN_num_bytes(tweak_num) > 0); g_assert(BN_num_bytes(tweak_num) <= tweak_size); @@ -1855,6 +1856,7 @@ static gint __encrypt_decrypt_bio(const struct cipher_parms *parms, BIO *b_in, g_set_error(err, PV_CRYPTO_ERROR, PV_CRYPTO_ERROR_INTERNAL, _("BN_bn2binpad failed")); + return -1; }; /* set new tweak */