LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: trix@redhat.com
To: brijesh.singh@amd.com, thomas.lendacky@amd.com,
	john.allen@amd.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, ashish.kalra@amd.com, rientjes@google.com
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tom Rix <trix@redhat.com>
Subject: [PATCH] crypto: initialize error variable
Date: Mon, 16 Aug 2021 12:23:12 -0700	[thread overview]
Message-ID: <20210816192312.1291783-1-trix@redhat.com> (raw)

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem
sev-dev.c:1094:19: warning: The left operand of '==' is a garbage value
        if (rc && (error == SEV_RET_SECURE_DATA_INVALID)) {
                   ~~~~~ ^

The error variable may not be set by the call to
sev_platform_init().  So initialize error to SEV_RET_SUCCESS.

Fixes: 1d55fdc85799 ("crypto: ccp - Retry SEV INIT command in case of integrity check failure.")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/crypto/ccp/sev-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 2ecb0e1f65d8d..b2b9f0f4daf2d 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1065,7 +1065,7 @@ void sev_pci_init(void)
 {
 	struct sev_device *sev = psp_master->sev_data;
 	struct page *tmr_page;
-	int error, rc;
+	int error = SEV_RET_SUCCESS, rc;
 
 	if (!sev)
 		return;
-- 
2.26.3


             reply	other threads:[~2021-08-16 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 19:23 trix [this message]
2021-08-16 20:01 ` Tom Lendacky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210816192312.1291783-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=ashish.kalra@amd.com \
    --cc=brijesh.singh@amd.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=thomas.lendacky@amd.com \
    --subject='Re: [PATCH] crypto: initialize error variable' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).