summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoyu Ye <benyxy@codeaurora.org>2018-07-31 11:34:20 -0700
committerXiaoyu Ye <benyxy@codeaurora.org>2018-08-06 15:58:53 -0700
commit1767f084900d22a0e1466f846b257f9f7f03b9ed (patch)
treed01cf120df55b5144006217e43068808a2a5968a
parent11ee621aea156ba9e1854335b0708f42fca975c7 (diff)
ASoC: wcd934x-dsp-cntl: initialize local char array val
Due to the local char array that stores the codec dsp control command is not initialized, an invalid command could cause the stack content to be printed out in kernel dmesg. Initialize the array with memset. Change-Id: I9573958fbe308c170c203a6a50a94d0540f3e7ce Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
-rw-r--r--sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c
index b682c37a1537..078e60fdca87 100644
--- a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c
+++ b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c
@@ -910,10 +910,12 @@ static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf,
{
struct wcd_dsp_cntl *cntl = container_of(filep->private_data,
struct wcd_dsp_cntl, miscdev);
- char val[WCD_DSP_CNTL_MAX_COUNT];
+ char val[WCD_DSP_CNTL_MAX_COUNT + 1];
bool vote;
int ret = 0;
+ memset(val, 0, WCD_DSP_CNTL_MAX_COUNT + 1);
+
if (count == 0 || count > WCD_DSP_CNTL_MAX_COUNT) {
pr_err("%s: Invalid count = %zd\n", __func__, count);
ret = -EINVAL;