Commit f8d7b13e14357ed19d2ca2799539600418dc3939

Authored by Dan Carpenter
Committed by Mark Brown
1 parent 5df498a27a

ASoC: max98095: a couple array underflows

The ->put() function are called from snd_ctl_elem_write() with user
supplied data.  The limit checks here could underflow leading to a
crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

sound/soc/codecs/max98095.c
... ... @@ -1863,7 +1863,7 @@
1863 1863 struct max98095_pdata *pdata = max98095->pdata;
1864 1864 int channel = max98095_get_eq_channel(kcontrol->id.name);
1865 1865 struct max98095_cdata *cdata;
1866   - int sel = ucontrol->value.integer.value[0];
  1866 + unsigned int sel = ucontrol->value.integer.value[0];
1867 1867 struct max98095_eq_cfg *coef_set;
1868 1868 int fs, best, best_val, i;
1869 1869 int regmask, regsave;
... ... @@ -2016,7 +2016,7 @@
2016 2016 struct max98095_pdata *pdata = max98095->pdata;
2017 2017 int channel = max98095_get_bq_channel(codec, kcontrol->id.name);
2018 2018 struct max98095_cdata *cdata;
2019   - int sel = ucontrol->value.integer.value[0];
  2019 + unsigned int sel = ucontrol->value.integer.value[0];
2020 2020 struct max98095_biquad_cfg *coef_set;
2021 2021 int fs, best, best_val, i;
2022 2022 int regmask, regsave;