mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: ADSPRPC: Add checks for erroneous values
Check for invalid parameters passed in user invocation and validate the return values using appropriate macros. Bug: 28767593 Change-Id: I9a067f2ab151084b46e9d4d5fb945320a27bb7ba Signed-off-by: Yuan Lin <yualin@google.com>
This commit is contained in:
parent
cebda807e6
commit
bedfff667d
1 changed files with 10 additions and 4 deletions
|
@ -163,7 +163,7 @@ static void free_mem(struct fastrpc_buf *buf)
|
|||
struct fastrpc_apps *me = &gfa;
|
||||
|
||||
if (buf->handle) {
|
||||
if (buf->virt) {
|
||||
if (!IS_ERR_OR_NULL(buf->virt)) {
|
||||
ion_unmap_kernel(me->iclient, buf->handle);
|
||||
buf->virt = 0;
|
||||
}
|
||||
|
@ -178,16 +178,19 @@ static int alloc_mem(struct fastrpc_buf *buf)
|
|||
struct sg_table *sg;
|
||||
int err = 0;
|
||||
|
||||
buf->virt = 0;
|
||||
buf->phys = 0;
|
||||
buf->handle = ion_alloc(clnt, buf->size, SZ_4K,
|
||||
ION_HEAP(ION_AUDIO_HEAP_ID), 0);
|
||||
VERIFY(err, 0 == IS_ERR_OR_NULL(buf->handle));
|
||||
if (err)
|
||||
goto bail;
|
||||
buf->virt = 0;
|
||||
VERIFY(err, 0 != (buf->virt = ion_map_kernel(clnt, buf->handle)));
|
||||
buf->virt = ion_map_kernel(clnt, buf->handle);
|
||||
VERIFY(err, 0 == IS_ERR_OR_NULL(buf->virt));
|
||||
if (err)
|
||||
goto bail;
|
||||
VERIFY(err, 0 != (sg = ion_sg_table(clnt, buf->handle)));
|
||||
sg = ion_sg_table(clnt, buf->handle);
|
||||
VERIFY(err, 0 == IS_ERR_OR_NULL(sg));
|
||||
if (err)
|
||||
goto bail;
|
||||
VERIFY(err, 1 == sg->nents);
|
||||
|
@ -296,6 +299,9 @@ static int get_page_list(uint32_t kernel, uint32_t sc, remote_arg_t *pra,
|
|||
list[i].num = 0;
|
||||
list[i].pgidx = 0;
|
||||
len = pra[i].buf.len;
|
||||
VERIFY(err, len >= 0);
|
||||
if (err)
|
||||
goto bail;
|
||||
if (!len)
|
||||
continue;
|
||||
buf = pra[i].buf.pv;
|
||||
|
|
Loading…
Reference in a new issue