diff options
| author | Vaishnavi Kommaraju <vkommara@codeaurora.org> | 2018-02-15 18:46:30 +0530 |
|---|---|---|
| committer | Vaishnavi Kommaraju <vkommara@codeaurora.org> | 2018-02-16 12:14:57 +0530 |
| commit | d5ed522486f627c4d67859565a8a1dcd48a595e4 (patch) | |
| tree | 8a841170d111d3906d8634a200c7eb82361ad69e | |
| parent | 1abb9c9f074f91ff8cbb62d29657e841cf4209e1 (diff) | |
ASoC: wcd934x-dsp-cntl: Limit array size of val
Limit size of val to WCD_DSP_CNTL_MAX_COUNT to avoid stack overflow.
CRs-Fixed: 2177167
Change-Id: I5d2b91e92305d6a485b2e8f959036504f0f55b13
Signed-off-by: Vaishnavi Kommaraju <vkommara@codeaurora.org>
| -rw-r--r-- | sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c index 29c218013a07..b682c37a1537 100644 --- a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c +++ b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -31,6 +31,7 @@ #define WCD_PROCFS_ENTRY_MAX_LEN 16 #define WCD_934X_RAMDUMP_START_ADDR 0x20100000 #define WCD_934X_RAMDUMP_SIZE ((1024 * 1024) - 128) +#define WCD_DSP_CNTL_MAX_COUNT 2 #define WCD_CNTL_MUTEX_LOCK(codec, lock) \ { \ @@ -909,11 +910,11 @@ 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[count]; + char val[WCD_DSP_CNTL_MAX_COUNT]; bool vote; int ret = 0; - if (count == 0 || count > 2) { + if (count == 0 || count > WCD_DSP_CNTL_MAX_COUNT) { pr_err("%s: Invalid count = %zd\n", __func__, count); ret = -EINVAL; goto done; |
