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>
Bu işleme şunda yer alıyor:
Vignesh Kulothungan
2020-09-30 12:05:28 -07:00
ebeveyn 3e60a43938
işleme 2d4ec76dfc

Dosyayı Görüntüle

@@ -2280,6 +2280,10 @@ static int afe_send_cps_config(int src_port)
continue; 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, memcpy(packed_payload + cpy_size,
&this_afe.cps_config->spkr_dep_cfg[i], &this_afe.cps_config->spkr_dep_cfg[i],
sizeof(struct lpass_swr_spkr_dep_cfg_t)); 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__, pr_err("%s: port = 0x%x param = 0x%x failed %d\n", __func__,
src_port, param_info.param_id, ret); src_port, param_info.param_id, ret);
fail_cmd:
pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__, pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__,
param_info.param_id, ret, src_port); param_info.param_id, ret, src_port);
kfree(packed_payload); kfree(packed_payload);