From b522d6a8f2b98aad4f651efaf3d2c9a85bd1b9d5 Mon Sep 17 00:00:00 2001 From: Laxminath Kasam Date: Fri, 16 Oct 2020 17:53:22 +0530 Subject: [PATCH] asoc: msm-pcm-q6-v2: Update memset for period size tinycap test can attempt with different size to read from driver and need to avoid access more than period size. Change-Id: Ifa4ddfb086bd83aa981da62e88da3a9395f5aabc Signed-off-by: Laxminath Kasam --- asoc/msm-pcm-q6-v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index d496d8921eb6..7f2368d00208 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -1008,9 +1008,9 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream, xfer = size; offset = prtd->in_frame_info[idx].offset; pr_debug("Offset value = %d\n", offset); - if (size == 0 || size < fbytes) { - memset(bufptr + offset + size, 0, fbytes - size); - size = xfer = fbytes; + if (size == 0 || size < prtd->pcm_count) { + memset(bufptr + offset + size, 0, prtd->pcm_count - size); + size = xfer = prtd->pcm_count; } if (copy_to_user(buf, bufptr+offset, xfer)) {