summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 5f4225e675ad..88b8f3f9a205 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -1004,6 +1004,11 @@ 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 (copy_to_user(buf, bufptr+offset, xfer)) {
pr_err("Failed to copy buf to user\n");
ret = -EFAULT;