[alsa-devel] [PATCH 7/9] ASoC: ml26124: Fix negative array index read

Takashi Iwai tiwai at suse.de
Wed Oct 30 08:35:05 CET 2013


get_coeff() may return an error.

Spotted by coverity CID 703394.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/soc/codecs/ml26124.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 26118828782b..4725aa445cc8 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -342,6 +342,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
 	struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec);
 	int i = get_coeff(priv->mclk, params_rate(hw_params));
 
+	if (i < 0)
+		return -EINVAL;
 	priv->substream = substream;
 	priv->rate = params_rate(hw_params);
 
-- 
1.8.4.1



More information about the Alsa-devel mailing list