summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-12-30 06:27:40 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-30 06:27:40 -0800
commit50f15acb6f1ff30efe034ff5f114551b1b2b3840 (patch)
tree37b2eb2c82d7ddeca59c3b451b570bf6e32ae3ff
parent9a111b700bb158f09fee06d10c96b5c9fc7802e8 (diff)
parentd1caf46af5d5fe3822481390eb4669aa809d890b (diff)
Merge "ASoC: wcd9330: Fix out of bounds for mad input value"
-rw-r--r--sound/soc/codecs/wcd9330.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd9330.c b/sound/soc/codecs/wcd9330.c
index fa396aa55ac9..1258c83e26a1 100644
--- a/sound/soc/codecs/wcd9330.c
+++ b/sound/soc/codecs/wcd9330.c
@@ -1536,6 +1536,13 @@ static int tomtom_mad_input_put(struct snd_kcontrol *kcontrol,
tomtom_mad_input = ucontrol->value.integer.value[0];
micb_4_int_reg = tomtom->resmgr.reg_addr->micb_4_int_rbias;
+ if (tomtom_mad_input >= ARRAY_SIZE(tomtom_conn_mad_text)) {
+ dev_err(codec->dev,
+ "%s: tomtom_mad_input = %d out of bounds\n",
+ __func__, tomtom_mad_input);
+ return -EINVAL;
+ }
+
pr_debug("%s: tomtom_mad_input = %s\n", __func__,
tomtom_conn_mad_text[tomtom_mad_input]);