diff options
| author | Karthikeyan Mani <kmani@codeaurora.org> | 2016-12-07 18:19:31 -0800 |
|---|---|---|
| committer | Joey Rizzoli <joey@lineageos.org> | 2017-06-12 23:11:36 +0200 |
| commit | 91b8e253f452e89dbebb817ed18d0d2cccc57939 (patch) | |
| tree | 1ec69a45cf924de29a994a926e1caa2d42790250 | |
| parent | 2aada083abcf9d76c5be17edfd434374d494877f (diff) | |
ASoC: wcd9320: Fix out of bounds for mad input value
Add check in taiko_mad_input_put function to
return error on out of bounds access using
mad input value
CRs-fixed: 1096799
Change-Id: I75ce9e881cf05a50e874a555b2f8bd3286cdaed4
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
| -rw-r--r-- | sound/soc/codecs/wcd9320.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd9320.c b/sound/soc/codecs/wcd9320.c index a057ac79cc6..64132c0b1ef 100644 --- a/sound/soc/codecs/wcd9320.c +++ b/sound/soc/codecs/wcd9320.c @@ -1295,7 +1295,15 @@ static int taiko_mad_input_put(struct snd_kcontrol *kcontrol, taiko_mad_input = ucontrol->value.integer.value[0]; + if (taiko_mad_input >= ARRAY_SIZE(taiko_conn_mad_text)) { + dev_err(codec->dev, + "%s: taiko_mad_input = %d out of bounds\n", + __func__, taiko_mad_input); + return -EINVAL; + } + micb_4_int_reg = taiko->resmgr.reg_addr->micb_4_int_rbias; + pr_debug("%s: taiko_mad_input = %s\n", __func__, taiko_conn_mad_text[taiko_mad_input]); |
