diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c index 2f048fddcb08..3f90347d491c 100644 --- a/sound/soc/msm/qdsp6v2/q6asm.c +++ b/sound/soc/msm/qdsp6v2/q6asm.c @@ -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);