public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Tom Rix <trix@redhat.com>,
	brijesh.singh@amd.com, john.allen@amd.com,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	nathan@kernel.org, ndesaulniers@google.com
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH v2] crypto: ccp: initialize error
Date: Tue, 10 Jan 2023 11:03:08 -0600	[thread overview]
Message-ID: <2205411f-ba62-c673-8752-5c02fc04fe2d@amd.com> (raw)
In-Reply-To: <20230110165316.2870300-1-trix@redhat.com>

On 1/10/23 10:53, Tom Rix wrote:
> clang static analysis reports this problem

s/clang/Clang/

> drivers/crypto/ccp/sev-dev.c:1347:3: warning: 3rd function call
>    argument is an uninitialized value [core.CallAndMessage]
>      dev_err(sev->dev, "SEV: failed to INIT error %#x, rc %d\n",
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> __sev_platform_init_locked() can return without setting the
> error parameter, causing the dev_err() to report a garbage
> value.
> 
> Fixes: 200664d5237f ("crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support")
> Signed-off-by: Tom Rix <trix@redhat.com>

The subject is pretty generic and confusing. A better subject would be:

crypto: ccp: Fix use of uninitialized variable

or something along that line.

Thanks,
Tom

> ---
> v2 : cleanup commit log
> ---
> 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 56998bc579d6..643cccc06a0b 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -1307,7 +1307,7 @@ EXPORT_SYMBOL_GPL(sev_issue_cmd_external_user);
>   void sev_pci_init(void)
>   {
>   	struct sev_device *sev = psp_master->sev_data;
> -	int error, rc;
> +	int error = 0, rc;
>   
>   	if (!sev)
>   		return;

      reply	other threads:[~2023-01-10 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 16:53 [PATCH v2] crypto: ccp: initialize error Tom Rix
2023-01-10 17:03 ` Tom Lendacky [this message]

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=2205411f-ba62-c673-8752-5c02fc04fe2d@amd.com \
    --to=thomas.lendacky@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=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox