summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-08 08:05:53 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-08 08:05:53 -0800
commitdfa7c4abacce5c0d6ed20949298846081bb85519 (patch)
tree7f698ca0b622463cf171b6acb0ea5c8de4eb736a
parent827cd4f6bbab291d3d880c3b8087965ad1954b6c (diff)
parent3923f3d037ebc5a5c05e460dfcb5973ccdfb5d78 (diff)
Merge "ASoC: wcd934x: Fix out of bounds for mad input value"
-rw-r--r--sound/soc/codecs/wcd934x/wcd934x.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd934x/wcd934x.c b/sound/soc/codecs/wcd934x/wcd934x.c
index 9b45db43ffb2..f2850d5e5ed3 100644
--- a/sound/soc/codecs/wcd934x/wcd934x.c
+++ b/sound/soc/codecs/wcd934x/wcd934x.c
@@ -5204,6 +5204,14 @@ static int tavil_mad_input_put(struct snd_kcontrol *kcontrol,
tavil_mad_input = ucontrol->value.integer.value[0];
+ if (tavil_mad_input >= sizeof(tavil_conn_mad_text)/
+ sizeof(tavil_conn_mad_text[0])) {
+ dev_err(codec->dev,
+ "%s: tavil_mad_input = %d out of bounds\n",
+ __func__, tavil_mad_input);
+ return -EINVAL;
+ }
+
if (strnstr(tavil_conn_mad_text[tavil_mad_input], "NOTUSED",
sizeof("NOTUSED"))) {
dev_dbg(codec->dev,