ASoC: msm: audio-effects: misc fixes in h/w accelerated effect

Adding memory copy size check and integer overflow check in h/w
accelerated effect driver.

Change-Id: I17d4cc0a38770f0c5067fa8047cd63e7bf085e48
CRs-Fixed: 1006609
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
This commit is contained in:
Weiyin Jiang 2016-04-26 14:35:38 +08:00 committed by Gerrit - the friendly Code Review server
parent 3f82d3527c
commit bf2ead3370
1 changed files with 6 additions and 0 deletions

View File

@ -1051,6 +1051,12 @@ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir,
ac->port[dir].buf = buf;
/* check for integer overflow */
if ((bufcnt > 0) && ((INT_MAX / bufcnt) < bufsz)) {
pr_err("%s: integer overflow\n", __func__);
mutex_unlock(&ac->cmd_lock);
goto fail;
}
bytes_to_alloc = bufsz * bufcnt;
/* The size to allocate should be multiple of 4K bytes */