Commit d3645b05 authored by Xiaojun Sang's avatar Xiaojun Sang Committed by Mark Brown

ASoC: compress: fix unsigned integer overflow check

Parameter fragments and fragment_size are type of u32. U32_MAX is
the correct check.
Signed-off-by: default avatarXiaojun Sang <xsang@codeaurora.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: default avatarVinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20191021095432.5639-1-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9110d1b0
...@@ -528,7 +528,7 @@ static int snd_compress_check_input(struct snd_compr_params *params) ...@@ -528,7 +528,7 @@ static int snd_compress_check_input(struct snd_compr_params *params)
{ {
/* first let's check the buffer parameter's */ /* first let's check the buffer parameter's */
if (params->buffer.fragment_size == 0 || if (params->buffer.fragment_size == 0 ||
params->buffer.fragments > INT_MAX / params->buffer.fragment_size || params->buffer.fragments > U32_MAX / params->buffer.fragment_size ||
params->buffer.fragments == 0) params->buffer.fragments == 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment