diff mbox

ASoC: Intel: Fix a buffer overflow issue

Message ID 1428408899-28677-1-git-send-email-yang.jie@intel.com (mailing list archive)
State Accepted
Commit 8e64aedf80ae14b852abc0d7ca262530b69e9a18
Headers show

Commit Message

Jie, Yang April 7, 2015, 12:14 p.m. UTC
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: Jie Yang <yang.jie@intel.com>
---
 sound/soc/intel/haswell/sst-haswell-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown April 8, 2015, 10:17 a.m. UTC | #1
On Tue, Apr 07, 2015 at 08:14:59PM +0800, Jie Yang wrote:
> 0day robot reported a buffer overflow issue:

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c
index 157b3a6..23ae040 100644
--- a/sound/soc/intel/haswell/sst-haswell-pcm.c
+++ b/sound/soc/intel/haswell/sst-haswell-pcm.c
@@ -1103,7 +1103,7 @@  static int hsw_pcm_probe(struct snd_soc_platform *platform)
 	return 0;
 
 err:
-	for (;i >= 0; i--) {
+	for (--i; i >= 0; i--) {
 		if (hsw_dais[i].playback.channels_min)
 			snd_dma_free_pages(&priv_data->dmab[i][0]);
 		if (hsw_dais[i].capture.channels_min)