Skip to content

Commit

Permalink
ASoC: wm8994: check for array index returned
Browse files Browse the repository at this point in the history
The array 'drc_cfg' of size 3 may use index value -22 (EINVAL)
The array 'retune_mobile_cfg' of size 3 may use index value -22 (EINVAL)

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Vinod Koul authored and Mark Brown committed May 28, 2013
1 parent 9767a58 commit 7d6898b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/soc/codecs/wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
int drc = wm8994_get_drc(kcontrol->id.name);

if (drc < 0)
return drc;
ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc];

return 0;
Expand Down Expand Up @@ -488,6 +490,9 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
int block = wm8994_get_retune_mobile_block(kcontrol->id.name);

if (block < 0)
return block;

ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block];

return 0;
Expand Down

0 comments on commit 7d6898b

Please sign in to comment.