Commit 8e64aedf authored by Jie Yang's avatar Jie Yang Committed by Mark Brown

ASoC: Intel: Fix a buffer overflow issue

0day robot reported a buffer overflow issue:

...
sound/soc/intel/haswell/sst-haswell-pcm.c:1107 hsw_pcm_probe() error: buffer\
overflow 'hsw_dais' 4 <= 4
sound/soc/intel/haswell/sst-haswell-pcm.c:1109 hsw_pcm_probe() error: buffer\
overflow 'hsw_dais' 4 <= 4
...

Fix it by initializing the index(i) to correct value.
Signed-off-by: default avatarJie Yang <yang.jie@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f34c4bc7
...@@ -1103,7 +1103,7 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform) ...@@ -1103,7 +1103,7 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
return 0; return 0;
err: err:
for (;i >= 0; i--) { for (--i; i >= 0; i--) {
if (hsw_dais[i].playback.channels_min) if (hsw_dais[i].playback.channels_min)
snd_dma_free_pages(&priv_data->dmab[i][0]); snd_dma_free_pages(&priv_data->dmab[i][0]);
if (hsw_dais[i].capture.channels_min) if (hsw_dais[i].capture.channels_min)
......
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