diff mbox series

ASoC: compress: fix unsigned integer overflow check

Message ID 20191021095432.5639-1-srinivas.kandagatla@linaro.org
State New
Headers show
Series ASoC: compress: fix unsigned integer overflow check | expand

Commit Message

Srinivas Kandagatla Oct. 21, 2019, 9:54 a.m. UTC
From: Xiaojun Sang <xsang@codeaurora.org>


Parameter fragments and fragment_size are type of u32. U32_MAX is
the correct check.

Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

---
 sound/core/compress_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.21.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Comments

Vinod Koul Oct. 21, 2019, 10:45 a.m. UTC | #1
On 21-10-19, 10:54, Srinivas Kandagatla wrote:
> From: Xiaojun Sang <xsang@codeaurora.org>

> 

> Parameter fragments and fragment_size are type of u32. U32_MAX is

> the correct check.


Acked-by: Vinod Koul <vkoul@kernel.org>


> Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---

>  sound/core/compress_offload.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c

> index 41905afada63..f34ce564d92c 100644

> --- a/sound/core/compress_offload.c

> +++ b/sound/core/compress_offload.c

> @@ -528,7 +528,7 @@ static int snd_compress_check_input(struct snd_compr_params *params)

>  {

>  	/* first let's check the buffer parameter's */

>  	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)

>  		return -EINVAL;

>  

> -- 

> 2.21.0


-- 
~Vinod
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff mbox series

Patch

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 41905afada63..f34ce564d92c 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -528,7 +528,7 @@  static int snd_compress_check_input(struct snd_compr_params *params)
 {
 	/* first let's check the buffer parameter's */
 	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)
 		return -EINVAL;