public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi: initialize len variable
@ 2022-03-20 13:59 trix
  2022-03-20 17:37 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2022-03-20 13:59 UTC (permalink / raw)
  To: minyard, nathan, ndesaulniers
  Cc: openipmi-developer, linux-kernel, llvm, Tom Rix

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this issue
ipmi_ssif.c:1731:3: warning: 4th function call
  argument is an uninitialized value
  dev_info(&ssif_info->client->dev,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The 4th parameter is the 'len' variable.
len is only set by a successful call to do_cmd().
Initialize to len 0.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/char/ipmi/ipmi_ssif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index ba779f1abb5b2..f199cc1948446 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1625,7 +1625,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	unsigned char     *resp;
 	struct ssif_info   *ssif_info;
 	int               rv = 0;
-	int               len;
+	int               len = 0;
 	int               i;
 	u8		  slave_addr = 0;
 	struct ssif_addr_info *addr_info = NULL;
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipmi: initialize len variable
  2022-03-20 13:59 [PATCH] ipmi: initialize len variable trix
@ 2022-03-20 17:37 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2022-03-20 17:37 UTC (permalink / raw)
  To: trix; +Cc: nathan, ndesaulniers, openipmi-developer, linux-kernel, llvm

On Sun, Mar 20, 2022 at 06:59:54AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Clang static analysis reports this issue
> ipmi_ssif.c:1731:3: warning: 4th function call
>   argument is an uninitialized value
>   dev_info(&ssif_info->client->dev,
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> The 4th parameter is the 'len' variable.
> len is only set by a successful call to do_cmd().
> Initialize to len 0.

Thanks, it's queued for next release..

-corey

> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/char/ipmi/ipmi_ssif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index ba779f1abb5b2..f199cc1948446 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1625,7 +1625,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	unsigned char     *resp;
>  	struct ssif_info   *ssif_info;
>  	int               rv = 0;
> -	int               len;
> +	int               len = 0;
>  	int               i;
>  	u8		  slave_addr = 0;
>  	struct ssif_addr_info *addr_info = NULL;
> -- 
> 2.26.3
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-20 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-20 13:59 [PATCH] ipmi: initialize len variable trix
2022-03-20 17:37 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox