summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-09-28 17:29:37 +0800
committerZefan Li <lizefan@huawei.com>2014-12-01 18:02:39 +0800
commite5b741351f667d05dd8be1a297202682d0cb4969 (patch)
tree020a27d45c07f48583b14d388187a49b878ab22e
parent3efcfa5433a7c6ff5e04489398b1d7434f51b733 (diff)
ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error.
commit 6596aa047b624aeec2ea321962cfdecf9953a383 upstream. Since we cannot make sure the 'params->num_regs' will always be none zero here, and then if it equals to zero, the kmemdup() will return ZERO_SIZE_PTR, which equals to ((void *)16). So this patch fix this with just doing the zero check before calling kmemdup(). Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org> [lizf: Backported to 3.4: adjust context] Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r--sound/soc/soc-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c88d9741b9e7..34c1fbb5b20b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2799,7 +2799,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
unsigned int val;
void *data;
- if (!codec->using_regmap)
+ if (!codec->using_regmap || !params->num_regs)
return -EINVAL;
data = ucontrol->value.bytes.data;