ipmi: initialize len variable
PATCH 1/1 ipmi: initialize len variable
From: Tom Rix <[email protected]>
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.
--- drivers/char/ipmi/ipmi_ssif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +1 -1
@@ -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 ;
Signature · 1 line
2.26.3
Quoted 11 lines · On Sun, Mar 20, 2022 at 06:59:54AM -0700, [email protected] wrote:
From: Tom Rix <[email protected]>
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
Quoted 22 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/char/ipmi/ipmi_ssif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/ipmi/ipmi_ssif.c +1
-1@@ -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 ;Signature · 1 line
2.26.3