diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-03-21 19:19:41 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-22 18:23:10 +0100 |
commit | aaea2164bdff39697d0f1ec69dcae62632e37974 (patch) | |
tree | 74aabce1117541b52efbffc448910f74c5628b9a /drivers/staging/wilc1000 | |
parent | a0e8045e6ecf982c73f6d4baa4683cad41a572c7 (diff) |
staging: wilc1000: check for kmalloc allocation failures
There are three kmalloc allocations that are not null checked which
potentially could lead to null pointer dereference issues. Fix this
by adding null pointer return checks.
Detected by CoverityScan, CID#1466025-27 ("Dereference null return")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000')
-rw-r--r-- | drivers/staging/wilc1000/host_interface.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 5082ede720f0..9b9b86654958 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -944,6 +944,10 @@ static s32 handle_connect(struct wilc_vif *vif, if (conn_attr->bssid) { hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL); + if (!hif_drv->usr_conn_req.bssid) { + result = -ENOMEM; + goto error; + } memcpy(hif_drv->usr_conn_req.bssid, conn_attr->bssid, 6); } @@ -951,6 +955,10 @@ static s32 handle_connect(struct wilc_vif *vif, if (conn_attr->ssid) { hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1, GFP_KERNEL); + if (!hif_drv->usr_conn_req.ssid) { + result = -ENOMEM; + goto error; + } memcpy(hif_drv->usr_conn_req.ssid, conn_attr->ssid, conn_attr->ssid_len); @@ -961,6 +969,10 @@ static s32 handle_connect(struct wilc_vif *vif, if (conn_attr->ies) { hif_drv->usr_conn_req.ies = kmalloc(conn_attr->ies_len, GFP_KERNEL); + if (!hif_drv->usr_conn_req.ies) { + result = -ENOMEM; + goto error; + } memcpy(hif_drv->usr_conn_req.ies, conn_attr->ies, conn_attr->ies_len); |