summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTharun Kumar Merugu <mtharu@codeaurora.org>2017-05-12 12:05:11 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-11 23:40:29 -0700
commit94e69df40141a3611650332576c0b9138866bd00 (patch)
tree86b1a0f9d83f65e2013dc6c7221b4144cc8a9c33 /drivers
parentae4d972f07f97de9a368a33820a7fe38284498c2 (diff)
msm: ADSPRPC: verify and initialize some variables
Verify cid variable before accessing it and initialize invoket variable before bailing out. Change-Id: Idec133bf8ba1a000b83f92bb567f0b75bbdab340 Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/adsprpc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index b1432ccf5358..38da42906994 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -1488,14 +1488,15 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
int err = 0;
struct timespec invoket;
+ if (fl->profile)
+ getnstimeofday(&invoket);
+
VERIFY(err, fl->sctx);
if (err)
goto bail;
VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS);
if (err)
goto bail;
- if (fl->profile)
- getnstimeofday(&invoket);
if (!kernel) {
VERIFY(err, 0 == context_restore_interrupted(fl, inv,
&ctx));
@@ -2440,6 +2441,9 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
if (err)
goto bail;
cid = fl->cid;
+ VERIFY(err, cid >= 0 && cid < NUM_CHANNELS);
+ if (err)
+ goto bail;
if (me->channel[cid].ssrcount !=
me->channel[cid].prevssrcount) {
if (!me->channel[cid].issubsystemup) {
@@ -2448,9 +2452,6 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
goto bail;
}
}
- VERIFY(err, cid >= 0 && cid < NUM_CHANNELS);
- if (err)
- goto bail;
fl->ssrcount = me->channel[cid].ssrcount;
if ((kref_get_unless_zero(&me->channel[cid].kref) == 0) ||
(me->channel[cid].chan == 0)) {