diff options
| author | Karthikeyan Mani <kmani@codeaurora.org> | 2016-12-12 11:04:01 -0800 |
|---|---|---|
| committer | Karthikeyan Mani <kmani@codeaurora.org> | 2016-12-13 10:27:44 -0800 |
| commit | 3923f3d037ebc5a5c05e460dfcb5973ccdfb5d78 (patch) | |
| tree | 9db2a700a97d1c65218ecf2e8382a5f179b46c4e | |
| parent | 3c45c2a8a2a07a76e2d129d02561d061211e70c8 (diff) | |
ASoC: wcd934x: Fix out of bounds for mad input value
Add check in tavil_mad_input_put function to
return error on out of bounds access using
mad input value.
CRs-fixed: 1100336
Change-Id: Icf424df0c0a0a774d43896e2d598d713004217db
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
| -rw-r--r-- | sound/soc/codecs/wcd934x/wcd934x.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd934x/wcd934x.c b/sound/soc/codecs/wcd934x/wcd934x.c index b0bb89c8d9c2..001f877d16b0 100644 --- a/sound/soc/codecs/wcd934x/wcd934x.c +++ b/sound/soc/codecs/wcd934x/wcd934x.c @@ -5177,6 +5177,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, |
