Pārlūkot izejas kodu

asoc: lpass-cdc: fix for array out-of-bound

add fix for arry out-of-bound.

Change-Id: Ib73c41f4f9b14f21143d88b4d768285a674e5f65
Signed-off-by: Prasad Kumpatla <[email protected]>
Prasad Kumpatla 2 gadi atpakaļ
vecāks
revīzija
3aa51212be
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c

+ 6 - 0
asoc/codecs/lpass-cdc/lpass-cdc-wsa-macro.c

@@ -1327,6 +1327,12 @@ static int lpass_cdc_wsa_macro_config_compander(struct snd_soc_component *compon
 	if (!lpass_cdc_wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
 		return -EINVAL;
 
+	if (comp >= LPASS_CDC_WSA_MACRO_COMP_MAX) {
+		dev_err(component->dev, "%s: Invalid compander value: %d\n",
+					__func__, comp);
+		return -EINVAL;
+	}
+
 	dev_dbg(component->dev, "%s: event %d compander %d, enabled %d\n",
 		__func__, event, comp + 1, wsa_priv->comp_enabled[comp]);