Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54fca86e authored by Vaibhav Raut's avatar Vaibhav Raut
Browse files

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: default avatarAkhil Karuturi <akarutur@codeaurora.org>
parent 38e81d82
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */


@@ -2907,18 +2908,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 = tstamp.copied_total;
		else
			runtime->total_bytes_available = tstamp.copied_total;
		tstamp.pcm_io_frames = 0;
		memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
		spin_unlock_irqrestore(&prtd->lock, flags);