mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
dsp: check speaker index before accessing array
Add check to validate the speaker index before accessing speaker config array. Change-Id: I7060806e327b46c044e5339f2c4bbd0e584feae5 Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:
parent
3e60a43938
commit
2d4ec76dfc
1 changed files with 6 additions and 0 deletions
|
|
@ -2280,6 +2280,10 @@ static int afe_send_cps_config(int src_port)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (i >= this_afe.num_spkrs) {
|
||||
pr_err("%s: invalid ch index %d\n", __func__, i);
|
||||
goto fail_cmd;
|
||||
}
|
||||
memcpy(packed_payload + cpy_size,
|
||||
&this_afe.cps_config->spkr_dep_cfg[i],
|
||||
sizeof(struct lpass_swr_spkr_dep_cfg_t));
|
||||
|
|
@ -2302,6 +2306,8 @@ static int afe_send_cps_config(int src_port)
|
|||
pr_err("%s: port = 0x%x param = 0x%x failed %d\n", __func__,
|
||||
src_port, param_info.param_id, ret);
|
||||
|
||||
|
||||
fail_cmd:
|
||||
pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__,
|
||||
param_info.param_id, ret, src_port);
|
||||
kfree(packed_payload);
|
||||
|
|
|
|||
Loading…
Reference in a new issue