ASoC: msm: qdsp6v2: check if index is out of range before use
Index can be assigned as -EINVAL which could be out of array index. Check if index is valid value before use. CRs-Fixed: 1046606 Change-Id: Ib1af53ab52a65cca2ed9b3489359813e690b1cd6 Signed-off-by: Meng Wang <mwang@codeaurora.org>
This commit is contained in:
parent
11d6060fff
commit
81b7a0a0e0
1 changed files with 6 additions and 0 deletions
|
@ -5591,6 +5591,12 @@ int afe_get_sp_th_vi_ftm_data(struct afe_sp_th_vi_get_param *th_vi)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
index = q6audio_get_port_index(port);
|
index = q6audio_get_port_index(port);
|
||||||
|
if (index < 0) {
|
||||||
|
pr_err("%s: invalid port 0x%x, index %d\n",
|
||||||
|
__func__, port, index);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
th_vi->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
th_vi->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
|
||||||
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
|
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
|
||||||
th_vi->hdr.pkt_size = sizeof(*th_vi);
|
th_vi->hdr.pkt_size = sizeof(*th_vi);
|
||||||
|
|
Loading…
Add table
Reference in a new issue