Commit c5586d0f authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Corey Minyard

ipmi:ssif: Add check for kstrdup

Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.

Fixes: c4436c91 ("ipmi_ssif: avoid registering duplicate ssif interface")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Message-Id: <20230619092802.35384-1-jiasheng@iscas.ac.cn>
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
parent 02210d52
......@@ -1600,6 +1600,11 @@ static int ssif_add_infos(struct i2c_client *client)
info->addr_src = SI_ACPI;
info->client = client;
info->adapter_name = kstrdup(client->adapter->name, GFP_KERNEL);
if (!info->adapter_name) {
kfree(info);
return -ENOMEM;
}
info->binfo.addr = client->addr;
list_add_tail(&info->link, &ssif_infos);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment