From fdaacf046874989a27d96a77944344f5cb9e2164 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Tue, 12 Sep 2017 15:58:19 +0800 Subject: [PATCH] ASoC: msm: fix integer overflow for long duration offload playback 32 bit variable is used for storing number of bytes copied to DSP, which can overflow when playback duration goes beyond 24 hours. Change data type for this variable to uint64_t to prevent overflow and related playback anomaly. CRs-Fixed: 877677 Change-Id: Ie4dfa630cf89559bb784d4712c52526665baeca6 Signed-off-by: Dhananjay Kumar Signed-off-by: Banajit Goswami Signed-off-by: Meng Wang --- include/uapi/sound/compress_offload.h | 4 ++++ sound/core/compress_offload.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index a215629614e3..56a72badd90e 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h @@ -67,7 +67,11 @@ struct snd_compr_params { */ struct snd_compr_tstamp { __u32 byte_offset; +#ifdef CONFIG_AUIDO_QGKI + __u64 copied_total; +#else __u32 copied_total; +#endif __u32 pcm_frames; __u32 pcm_io_frames; __u32 sampling_rate; diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 41905afada63..de1f49352ccd 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -171,8 +171,13 @@ static int snd_compr_update_tstamp(struct snd_compr_stream *stream, if (!stream->ops->pointer) return -ENOTSUPP; stream->ops->pointer(stream, tstamp); +#ifdef CONFIG_AUDIO_QGKI + pr_debug("dsp consumed till %d total %llu bytes\n", + tstamp->byte_offset, tstamp->copied_total); +#else pr_debug("dsp consumed till %d total %d bytes\n", tstamp->byte_offset, tstamp->copied_total); +#endif if (stream->direction == SND_COMPRESS_PLAYBACK) stream->runtime->total_bytes_transferred = tstamp->copied_total; else