Commit 025c3fa9 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

ASoC: sta32x: Fix array access overflow

Preset EQ enum of sta32x codec driver declares too many number of
items and it may lead to the access over the actual array size.

Use SOC_ENUM_SINGLE_DECL() helper and it's automatically fixed.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Acked-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
parent 38dbfb59
...@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = { ...@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = {
13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),
}; };
static const struct soc_enum sta32x_drc_ac_enum = static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum,
SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
2, sta32x_drc_ac); sta32x_drc_ac);
static const struct soc_enum sta32x_auto_eq_enum = static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum,
SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
3, sta32x_auto_eq_mode); sta32x_auto_eq_mode);
static const struct soc_enum sta32x_auto_gc_enum = static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum,
SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
4, sta32x_auto_gc_mode); sta32x_auto_gc_mode);
static const struct soc_enum sta32x_auto_xo_enum = static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum,
SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
16, sta32x_auto_xo_mode); sta32x_auto_xo_mode);
static const struct soc_enum sta32x_preset_eq_enum = static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum,
SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
32, sta32x_preset_eq_mode); sta32x_preset_eq_mode);
static const struct soc_enum sta32x_limiter_ch1_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum,
SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
3, sta32x_limiter_select); sta32x_limiter_select);
static const struct soc_enum sta32x_limiter_ch2_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum,
SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
3, sta32x_limiter_select); sta32x_limiter_select);
static const struct soc_enum sta32x_limiter_ch3_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum,
SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
3, sta32x_limiter_select); sta32x_limiter_select);
static const struct soc_enum sta32x_limiter1_attack_rate_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum,
SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT, STA32X_L1AR, STA32X_LxA_SHIFT,
16, sta32x_limiter_attack_rate); sta32x_limiter_attack_rate);
static const struct soc_enum sta32x_limiter2_attack_rate_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum,
SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT, STA32X_L2AR, STA32X_LxA_SHIFT,
16, sta32x_limiter_attack_rate); sta32x_limiter_attack_rate);
static const struct soc_enum sta32x_limiter1_release_rate_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum,
SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT, STA32X_L1AR, STA32X_LxR_SHIFT,
16, sta32x_limiter_release_rate); sta32x_limiter_release_rate);
static const struct soc_enum sta32x_limiter2_release_rate_enum = static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum,
SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT, STA32X_L2AR, STA32X_LxR_SHIFT,
16, sta32x_limiter_release_rate); sta32x_limiter_release_rate);
/* byte array controls for setting biquad, mixer, scaling coefficients; /* byte array controls for setting biquad, mixer, scaling coefficients;
* for biquads all five coefficients need to be set in one go, * for biquads all five coefficients need to be set in one go,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment