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>
This commit is contained in:
parent
ae4d972f07
commit
94e69df401
1 changed files with 6 additions and 5 deletions
|
@ -1488,14 +1488,15 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
|
||||||
int err = 0;
|
int err = 0;
|
||||||
struct timespec invoket;
|
struct timespec invoket;
|
||||||
|
|
||||||
|
if (fl->profile)
|
||||||
|
getnstimeofday(&invoket);
|
||||||
|
|
||||||
VERIFY(err, fl->sctx);
|
VERIFY(err, fl->sctx);
|
||||||
if (err)
|
if (err)
|
||||||
goto bail;
|
goto bail;
|
||||||
VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS);
|
VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS);
|
||||||
if (err)
|
if (err)
|
||||||
goto bail;
|
goto bail;
|
||||||
if (fl->profile)
|
|
||||||
getnstimeofday(&invoket);
|
|
||||||
if (!kernel) {
|
if (!kernel) {
|
||||||
VERIFY(err, 0 == context_restore_interrupted(fl, inv,
|
VERIFY(err, 0 == context_restore_interrupted(fl, inv,
|
||||||
&ctx));
|
&ctx));
|
||||||
|
@ -2440,6 +2441,9 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
|
||||||
if (err)
|
if (err)
|
||||||
goto bail;
|
goto bail;
|
||||||
cid = fl->cid;
|
cid = fl->cid;
|
||||||
|
VERIFY(err, cid >= 0 && cid < NUM_CHANNELS);
|
||||||
|
if (err)
|
||||||
|
goto bail;
|
||||||
if (me->channel[cid].ssrcount !=
|
if (me->channel[cid].ssrcount !=
|
||||||
me->channel[cid].prevssrcount) {
|
me->channel[cid].prevssrcount) {
|
||||||
if (!me->channel[cid].issubsystemup) {
|
if (!me->channel[cid].issubsystemup) {
|
||||||
|
@ -2448,9 +2452,6 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VERIFY(err, cid >= 0 && cid < NUM_CHANNELS);
|
|
||||||
if (err)
|
|
||||||
goto bail;
|
|
||||||
fl->ssrcount = me->channel[cid].ssrcount;
|
fl->ssrcount = me->channel[cid].ssrcount;
|
||||||
if ((kref_get_unless_zero(&me->channel[cid].kref) == 0) ||
|
if ((kref_get_unless_zero(&me->channel[cid].kref) == 0) ||
|
||||||
(me->channel[cid].chan == 0)) {
|
(me->channel[cid].chan == 0)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue