diff options
author | Dan Carpenter | 2018-12-21 10:06:58 +0100 |
---|---|---|
committer | Mark Brown | 2019-01-03 17:32:57 +0100 |
commit | 678e2b44c8e3fec3afc7202f1996a4500a50be93 (patch) | |
tree | a189206cb58a46b267a11e2bc7b54d64721e6952 /sound/soc | |
parent | ASoC: qdsp6: q6asm-dai: Fix a small memory leak (diff) | |
download | kernel-qcow2-linux-678e2b44c8e3fec3afc7202f1996a4500a50be93.tar.gz kernel-qcow2-linux-678e2b44c8e3fec3afc7202f1996a4500a50be93.tar.xz kernel-qcow2-linux-678e2b44c8e3fec3afc7202f1996a4500a50be93.zip |
ALSA: compress: prevent potential divide by zero bugs
The problem is seen in the q6asm_dai_compr_set_params() function:
ret = q6asm_map_memory_regions(dir, prtd->audio_client, prtd->phys,
(prtd->pcm_size / prtd->periods),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prtd->periods);
In this code prtd->pcm_size is the buffer_size and prtd->periods comes
from params->buffer.fragments. If we allow the number of fragments to
be zero then it results in a divide by zero bug. One possible fix would
be to use prtd->pcm_count directly instead of using the division to
re-calculate it. But I decided that it doesn't really make sense to
allow zero fragments.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
0 files changed, 0 insertions, 0 deletions