From 902fbb8b5ddb009d0cc53fa5a2847085d4dfde8b Mon Sep 17 00:00:00 2001 From: Akhil Karuturi Date: Tue, 15 Sep 2020 23:24:20 -0700 Subject: [PATCH] Asoc: fix integer overflow for long duration offload playback update runtime total bytes transferred and received in compress driver. Change-Id: I1bd129e18681fcf10a27efaa061594081114c1fb Signed-off-by: Akhil Karuturi --- asoc/msm-compress-q6-v2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c index 09c5b0f43d18..feb09b9c7426 100644 --- a/asoc/msm-compress-q6-v2.c +++ b/asoc/msm-compress-q6-v2.c @@ -3083,18 +3083,18 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, spin_lock_irqsave(&prtd->lock, flags); tstamp.sampling_rate = prtd->sample_rate; tstamp.byte_offset = prtd->byte_offset; - if (cstream->direction == SND_COMPRESS_PLAYBACK) + if (cstream->direction == SND_COMPRESS_PLAYBACK) { + runtime->total_bytes_transferred = prtd->copied_total; tstamp.copied_total = prtd->copied_total; - else if (cstream->direction == SND_COMPRESS_CAPTURE) + } + else if (cstream->direction == SND_COMPRESS_CAPTURE) { + runtime->total_bytes_available = prtd->received_total; tstamp.copied_total = prtd->received_total; + } first_buffer = prtd->first_buffer; if (atomic_read(&prtd->error)) { pr_err_ratelimited("%s Got RESET EVENTS notification, return error\n", __func__); - if (cstream->direction == SND_COMPRESS_PLAYBACK) - runtime->total_bytes_transferred = prtd->copied_total; - else - runtime->total_bytes_available = prtd->received_total; tstamp.pcm_io_frames = 0; memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp)); spin_unlock_irqrestore(&prtd->lock, flags);