asoc : msm: Fix zero size pointer issue
APPS crashes randomly due to invalid memory allocation in q6asm_audio_client_buf_free_contiguous. Added check to return error if memory allocation size is 0. Change-Id: I40f49aa147d513b29b56224a5ee77ccbb2dcc110 CRs-Fixed: 2285272 Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
This commit is contained in:
parent
f09b84f8ea
commit
5206b51937
1 changed files with 6 additions and 0 deletions
|
@ -1567,6 +1567,12 @@ int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir,
|
|||
pr_err("%s: buffer already allocated\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bufcnt == 0) {
|
||||
pr_err("%s: invalid buffer count\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&ac->cmd_lock);
|
||||
buf = kzalloc(((sizeof(struct audio_buffer))*bufcnt),
|
||||
GFP_KERNEL);
|
||||
|
|
Loading…
Add table
Reference in a new issue