[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnde5qmYCsU1V4ccRn4tkEmPZLwJ2UFFLQfR-to7wLQTw@mail.gmail.com>
Date: Tue, 17 Jan 2023 10:17:45 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Tom Rix <trix@...hat.com>
Cc: brijesh.singh@....com, thomas.lendacky@....com, john.allen@....com,
herbert@...dor.apana.org.au, davem@...emloft.net,
nathan@...nel.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v3] crypto: ccp: initialize 'error' variable to zero
On Tue, Jan 10, 2023 at 9:09 AM Tom Rix <trix@...hat.com> wrote:
>
> Clang static analysis reports this problem
> 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@...hat.com>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
> v2 cleanup commit log
> v3 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;
> --
> 2.27.0
>
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists