ASoC: msm-pcm-q6-v2: Add size check

Check if buf size is valid before comparing
with buf offset.

Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
Change-Id: I8336be046c4922ce2f8bb333b58ca867059e9528
This commit is contained in:
Soumya Managoli 2024-02-23 10:04:53 +05:30
commit c17bb7ef22

View file

@ -1329,7 +1329,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
offset = prtd->in_frame_info[idx].offset;
pr_debug("Offset value = %d\n", offset);
if (offset >= size) {
if (size && offset >= size) {
pr_err("%s: Invalid dsp buf offset\n", __func__);
ret = -EFAULT;
q6asm_cpu_buf_release(OUT, prtd->audio_client);