msm: adsprpc: Add error handling checks

Add null pointer check and VERIFY statement for error handling.

Change-Id: Ie51fddd4e279de0246b3b45fe0a947fe5ebb96c3
Acked-by: Maitreyi Gupta <maitreyi@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
This commit is contained in:
Tharun Kumar Merugu
2019-06-04 10:49:24 +05:30
committed by Gerrit - the friendly Code Review server
parent 004818ff21
commit abaa853cfe

View File

@ -1659,10 +1659,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
mutex_lock(&ctx->fl->map_mutex);
if (ctx->fds && (ctx->fds[i] != -1))
fastrpc_mmap_create(ctx->fl, ctx->fds[i],
err = fastrpc_mmap_create(ctx->fl, ctx->fds[i],
ctx->attrs[i], buf, len,
mflags, &ctx->maps[i]);
mutex_unlock(&ctx->fl->map_mutex);
if (err)
goto bail;
ipage += 1;
}
PERF_END);
@ -1673,9 +1675,10 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
if (ctx->attrs && (ctx->attrs[i] & FASTRPC_ATTR_NOMAP))
dmaflags = FASTRPC_DMAHANDLE_NOMAP;
VERIFY(err, !fastrpc_mmap_create(ctx->fl, ctx->fds[i],
FASTRPC_ATTR_NOVA, 0, 0, dmaflags,
&ctx->maps[i]));
if (ctx->fds && (ctx->fds[i] != -1))
err = fastrpc_mmap_create(ctx->fl, ctx->fds[i],
FASTRPC_ATTR_NOVA, 0, 0, dmaflags,
&ctx->maps[i]);
if (err) {
mutex_unlock(&ctx->fl->map_mutex);
goto bail;