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 <benyxy@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
a60b408c5a
commit
6c0100f281
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// 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 <linux/module.h>
|
#include <linux/module.h>
|
||||||
@@ -900,9 +900,8 @@ ssize_t audio_in_write(struct file *file,
|
|||||||
__func__, audio->ac->session);
|
__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)) {
|
if (copy_from_user(cpy_ptr, buf, xfer)) {
|
||||||
rc = -EFAULT;
|
rc = -EFAULT;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user