summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxminath Kasam <lkasam@codeaurora.org>2020-10-16 17:53:22 +0530
committerAlexander Grund <flamefire89@gmail.com>2023-12-23 19:58:21 +0100
commit00342495f3fdef61c9be3fc92e757e58d32ab5a7 (patch)
tree495f128f24f9a0d373230007c6be74e84b68ad94
parentce75dd05065bc32b0a67b1ea38de5ee9aaba3985 (diff)
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 <lkasam@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 88b8f3f9a205..0b663d72394e 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -1004,9 +1004,9 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
goto fail;
}
- 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)) {