diff mbox series

[1/2] Fix static checker warning

Message ID 31c49295223e51f5c1c4e36e7a09fe100dab1711.1536959537.git.Janakarajan.Natarajan@amd.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series Miscellaneous SEV fixes | expand

Commit Message

Janakarajan Natarajan Sept. 14, 2018, 10:32 p.m. UTC
Under certain configuration SEV functions can be defined as no-op.
In such a case error can be uninitialized.

Initialize the variable to 0.

Cc: Dan Carpenter <Dan.Carpenter@oracle.com>
Reported-by: Dan Carpenter <Dan.Carpenter@oracle.com>
Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
---
 drivers/crypto/ccp/psp-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gary R Hook Sept. 19, 2018, 1:40 p.m. UTC | #1
On 09/14/2018 05:32 PM, Janakarajan Natarajan wrote:
> Under certain configuration SEV functions can be defined as no-op.
> In such a case error can be uninitialized.
> 
> Initialize the variable to 0.
> 
> Cc: Dan Carpenter <Dan.Carpenter@oracle.com>
> Reported-by: Dan Carpenter <Dan.Carpenter@oracle.com>
> Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>

Acked-by: Gary R Hook <gary.hook@amd.com>

> ---
>   drivers/crypto/ccp/psp-dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
> index 72790d8..f541e60 100644
> --- a/drivers/crypto/ccp/psp-dev.c
> +++ b/drivers/crypto/ccp/psp-dev.c
> @@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(psp_copy_user_blob);
>   static int sev_get_api_version(void)
>   {
>   	struct sev_user_data_status *status;
> -	int error, ret;
> +	int error = 0, ret;
>   
>   	status = &psp_master->status_cmd_buf;
>   	ret = sev_platform_status(status, &error);
>
Dan Carpenter Sept. 19, 2018, 1:57 p.m. UTC | #2
Sounds reasonable.  The subject needs a subsystem prefix and it might
be better to make it more specific.  Like so:

[PATCH 1/2] crypto: ccp - potential uninitialized variable

I don't know if Herbert fixes those things up himself normally?

regards,
dan carpenter
Janakarajan Natarajan Sept. 20, 2018, 3:43 p.m. UTC | #3
On 9/19/2018 8:57 AM, Dan Carpenter wrote:
> Sounds reasonable.  The subject needs a subsystem prefix and it might
> be better to make it more specific.  Like so:
>
> [PATCH 1/2] crypto: ccp - potential uninitialized variable

I'll put out a v2 with the subjects fixed.

Thanks.

>
> I don't know if Herbert fixes those things up himself normally?
>
> regards,
> dan carpenter
>
Herbert Xu Sept. 21, 2018, 4:52 a.m. UTC | #4
On Thu, Sep 20, 2018 at 03:43:48PM +0000, Natarajan, Janakarajan wrote:
> On 9/19/2018 8:57 AM, Dan Carpenter wrote:
> > Sounds reasonable.  The subject needs a subsystem prefix and it might
> > be better to make it more specific.  Like so:
> >
> > [PATCH 1/2] crypto: ccp - potential uninitialized variable
> 
> I'll put out a v2 with the subjects fixed.

This is not necessary.  I'll fix it up when I apply the patch.

Thanks,
diff mbox series

Patch

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 72790d8..f541e60 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -423,7 +423,7 @@  EXPORT_SYMBOL_GPL(psp_copy_user_blob);
 static int sev_get_api_version(void)
 {
 	struct sev_user_data_status *status;
-	int error, ret;
+	int error = 0, ret;
 
 	status = &psp_master->status_cmd_buf;
 	ret = sev_platform_status(status, &error);