ASoC: wcd9330: Fix out of bounds for mad input value
Add check in tomtom_mad_input_put function to return error on out of bounds access using mad input value. CRs-fixed: 1096799 Change-Id: Ied86bf88301e555b25eaa190d2d786cdad691ccd Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
parent
3c45c2a8a2
commit
d1caf46af5
1 changed files with 7 additions and 0 deletions
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue