From 6c0100f281bbcf8106e28f3d823ed0869e55d144 Mon Sep 17 00:00:00 2001 From: Xiaoyu Ye Date: Fri, 1 Feb 2019 17:55:06 -0800 Subject: [PATCH] dsp: codecs: fix range check for audio buffer copying The range checking for audio buffer copying in function "audio_in_write" is using the incorrect buffer size. Change it to the actual allocated audio buffer size. Change-Id: Icb9a9e9c3b3d3c6e55e7bad20b34f94784b82674 Signed-off-by: Xiaoyu Ye --- dsp/codecs/audio_utils.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dsp/codecs/audio_utils.c b/dsp/codecs/audio_utils.c index 1c44fcceb7f4..26e9b0b36044 100644 --- a/dsp/codecs/audio_utils.c +++ b/dsp/codecs/audio_utils.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2019, The Linux Foundation. All rights reserved. */ #include @@ -900,9 +900,8 @@ ssize_t audio_in_write(struct file *file, __func__, audio->ac->session); } } - xfer = (count > (audio->pcm_cfg.buffer_size)) ? - (audio->pcm_cfg.buffer_size) : count; + xfer = (count > size) ? size : count; if (copy_from_user(cpy_ptr, buf, xfer)) { rc = -EFAULT; break;