mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type
Accessing enums using integer would result in array out of bounds access
on platforms like aarch64 where sizeof(long) is 8 compared to enum size
which is 4 bytes.
Fixes: 4f692926f5
("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
42c709c4e1
commit
bcfe5f76cc
@ -2272,7 +2272,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
|
||||||
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.enumerated.item[0] =
|
||||||
rx->rx_port_value[widget->shift];
|
rx->rx_port_value[widget->shift];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2284,7 +2284,7 @@ static int rx_macro_mux_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
struct snd_soc_dapm_update *update = NULL;
|
struct snd_soc_dapm_update *update = NULL;
|
||||||
u32 rx_port_value = ucontrol->value.integer.value[0];
|
u32 rx_port_value = ucontrol->value.enumerated.item[0];
|
||||||
u32 aif_rst;
|
u32 aif_rst;
|
||||||
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
@ -2396,7 +2396,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = rx->hph_pwr_mode;
|
ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2406,7 +2406,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
struct rx_macro *rx = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
rx->hph_pwr_mode = ucontrol->value.integer.value[0];
|
rx->hph_pwr_mode = ucontrol->value.enumerated.item[0];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user