diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2018-08-31 11:00:34 -0400 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2018-08-31 15:13:56 -0400 |
commit | a8627cda7cfffe1792c199660c2b4f03ba2bd97b (patch) | |
tree | 17d597c0c73bea52c883c2b20808123679e2e5ab | |
parent | 0745dde62835be7e2afe62fcdb482fcad79cb743 (diff) |
ipmi: Fix NULL pointer dereference in ssif_probe
There is a potential execution path in which function ssif_info_find()
returns NULL, hence there is a NULL pointer dereference when accessing
pointer *addr_info*
Fix this by null checking *addr_info* before dereferencing it.
Addresses-Coverity-ID: 1473145 ("Explicit null dereferenced")
Fixes: e333054a91d1 ("ipmi: Fix I2C client removal in the SSIF driver")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 265d6a6583bc..29e67a80fb20 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c | |||
@@ -1643,7 +1643,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1643 | 1643 | ||
1644 | out: | 1644 | out: |
1645 | if (rv) { | 1645 | if (rv) { |
1646 | addr_info->client = NULL; | 1646 | if (addr_info) |
1647 | addr_info->client = NULL; | ||
1648 | |||
1647 | dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv); | 1649 | dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv); |
1648 | kfree(ssif_info); | 1650 | kfree(ssif_info); |
1649 | } | 1651 | } |