qseecom: allocate sglistinfo buffer for kernel clients

To support whitelist feature, sglistinfo table should also
be allocated from qseecom kernel APIs used by kernel client.
Besides, initialize sg in __qseecom_update_cmd_buf_64 to
address a static analysis warning.

Change-Id: I1f1967fd9e95444cca728f09e3e8f4914b2abb95
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
Zhen Kong 2016-09-01 10:20:50 -07:00 committed by Gerrit - the friendly Code Review server
parent ab26d09879
commit bde23716c3

View file

@ -3249,6 +3249,7 @@ static int __qseecom_update_cmd_buf_64(void *msg, bool cleanup,
} }
} }
len = QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT; len = QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT;
sg = sg_ptr->sgl;
goto cleanup; goto cleanup;
} }
sg = sg_ptr->sgl; sg = sg_ptr->sgl;
@ -4015,12 +4016,21 @@ int qseecom_start_app(struct qseecom_handle **handle,
data->client.user_virt_sb_base = 0; data->client.user_virt_sb_base = 0;
data->client.ihandle = NULL; data->client.ihandle = NULL;
/* Allocate sglistinfo buffer for kernel client */
data->sglistinfo_ptr = kzalloc(SGLISTINFO_TABLE_SIZE, GFP_KERNEL);
if (!(data->sglistinfo_ptr)) {
kfree(data);
kfree(*handle);
*handle = NULL;
return -ENOMEM;
}
init_waitqueue_head(&data->abort_wq); init_waitqueue_head(&data->abort_wq);
data->client.ihandle = ion_alloc(qseecom.ion_clnt, size, 4096, data->client.ihandle = ion_alloc(qseecom.ion_clnt, size, 4096,
ION_HEAP(ION_QSECOM_HEAP_ID), 0); ION_HEAP(ION_QSECOM_HEAP_ID), 0);
if (IS_ERR_OR_NULL(data->client.ihandle)) { if (IS_ERR_OR_NULL(data->client.ihandle)) {
pr_err("Ion client could not retrieve the handle\n"); pr_err("Ion client could not retrieve the handle\n");
kfree(data->sglistinfo_ptr);
kfree(data); kfree(data);
kfree(*handle); kfree(*handle);
*handle = NULL; *handle = NULL;
@ -4118,6 +4128,7 @@ int qseecom_start_app(struct qseecom_handle **handle,
return 0; return 0;
err: err:
kfree(data->sglistinfo_ptr);
kfree(data); kfree(data);
kfree(*handle); kfree(*handle);
*handle = NULL; *handle = NULL;
@ -4165,6 +4176,7 @@ int qseecom_shutdown_app(struct qseecom_handle **handle)
mutex_unlock(&app_access_lock); mutex_unlock(&app_access_lock);
if (ret == 0) { if (ret == 0) {
kzfree(data->sglistinfo_ptr);
kzfree(data); kzfree(data);
kzfree(*handle); kzfree(*handle);
kzfree(kclient); kzfree(kclient);