asoc: codecs: Fix Bolero and WSA out-of-range variables
Found potential issues relating to uninitialized or out-of-bounds variables present in codec drivers. Place checks to ensure proper ranges are used. Change-Id: Ib68cba2413788a57237f1f18fc5ce5fb5c6bfb0a Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
Dieser Commit ist enthalten in:

committet von
Gerrit - the friendly Code Review server

Ursprung
018369d65f
Commit
9d7405ec04
@@ -1584,9 +1584,9 @@ static int lpass_cdc_wsa_macro_config_softclip(struct snd_soc_component *compone
|
||||
static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
||||
int path, int event)
|
||||
{
|
||||
u16 reg1, reg2, reg3;
|
||||
struct device *wsa_dev = NULL;
|
||||
struct lpass_cdc_wsa_macro_priv *wsa_priv = NULL;
|
||||
u16 reg1 = 0, reg2 = 0, reg3 = 0;
|
||||
int softclip_path = 0;
|
||||
|
||||
if (!lpass_cdc_wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
|
||||
@@ -1605,7 +1605,7 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
||||
}
|
||||
if (!wsa_priv->pbr_enable || wsa_priv->wsa_bat_cfg[path] >= EXT_1S ||
|
||||
wsa_priv->wsa_sys_gain[path * 2] > G_12_DB ||
|
||||
wsa_priv->wsa_spkrrecv)
|
||||
wsa_priv->wsa_spkrrecv || !reg1 || !reg2 || !reg3)
|
||||
return 0;
|
||||
|
||||
if (SND_SOC_DAPM_EVENT_ON(event)) {
|
||||
|
@@ -758,7 +758,9 @@ static int wsa_dev_mode_put(struct snd_kcontrol *kcontrol,
|
||||
dev_dbg(component->dev, "%s: Dev Mode current: %d, new: %d = %ld\n",
|
||||
__func__, wsa884x->dev_mode, dev_mode);
|
||||
|
||||
if (dev_mode >= SPEAKER && dev_mode <= RECEIVER) {
|
||||
/* Check if input parameter is in range */
|
||||
if ((wsa884x->dev_mode + (wsa884x->dev_index - 1) * 2) <
|
||||
(MAX_DEV_MODE * 2)) {
|
||||
wsa884x->dev_mode = dev_mode;
|
||||
wsa884x->system_gain = wsa884x->sys_gains[
|
||||
wsa884x->dev_mode + (wsa884x->dev_index - 1) * 2];
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren