All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: perex@perex.cz, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH] ASoC: qcom: sm8250: Fix array out of bounds access
Date: Wed, 28 Oct 2020 14:24:10 +0000	[thread overview]
Message-ID: <4fc6b58a-e3e6-b57e-7ae7-16fd32392bcb@canonical.com> (raw)
In-Reply-To: <20201028142001.22431-1-srinivas.kandagatla@linaro.org>

On 28/10/2020 14:20, Srinivas Kandagatla wrote:
> Static analysis Coverity had detected a potential array out-of-bounds
> write issue due to the fact that MAX AFE port Id was set to 16 instead
> of using AFE_PORT_MAX macro.
> 
> Fix this by properly using AFE_PORT_MAX macro.
> 
> Fixes: aa2e2785545a ("ASoC: qcom: sm8250: add sound card qrb5165-rb5 support")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/sm8250.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
> index 7d43de6d909f..52c40512102f 100644
> --- a/sound/soc/qcom/sm8250.c
> +++ b/sound/soc/qcom/sm8250.c
> @@ -13,12 +13,11 @@
>  
>  #define DRIVER_NAME		"sm8250"
>  #define MI2S_BCLK_RATE		1536000
> -#define MAX_SDW_STREAMS		16
>  
>  struct sm8250_snd_data {
> -	bool stream_prepared[MAX_SDW_STREAMS];
> +	bool stream_prepared[AFE_PORT_MAX];
>  	struct snd_soc_card *card;
> -	struct sdw_stream_runtime *sruntime[MAX_SDW_STREAMS];
> +	struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
>  };
>  
>  static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
> 

Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>

WARNING: multiple messages have this Message-ID (diff)
From: Colin Ian King <colin.king@canonical.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: lgirdwood@gmail.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: sm8250: Fix array out of bounds access
Date: Wed, 28 Oct 2020 14:24:10 +0000	[thread overview]
Message-ID: <4fc6b58a-e3e6-b57e-7ae7-16fd32392bcb@canonical.com> (raw)
In-Reply-To: <20201028142001.22431-1-srinivas.kandagatla@linaro.org>

On 28/10/2020 14:20, Srinivas Kandagatla wrote:
> Static analysis Coverity had detected a potential array out-of-bounds
> write issue due to the fact that MAX AFE port Id was set to 16 instead
> of using AFE_PORT_MAX macro.
> 
> Fix this by properly using AFE_PORT_MAX macro.
> 
> Fixes: aa2e2785545a ("ASoC: qcom: sm8250: add sound card qrb5165-rb5 support")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/sm8250.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
> index 7d43de6d909f..52c40512102f 100644
> --- a/sound/soc/qcom/sm8250.c
> +++ b/sound/soc/qcom/sm8250.c
> @@ -13,12 +13,11 @@
>  
>  #define DRIVER_NAME		"sm8250"
>  #define MI2S_BCLK_RATE		1536000
> -#define MAX_SDW_STREAMS		16
>  
>  struct sm8250_snd_data {
> -	bool stream_prepared[MAX_SDW_STREAMS];
> +	bool stream_prepared[AFE_PORT_MAX];
>  	struct snd_soc_card *card;
> -	struct sdw_stream_runtime *sruntime[MAX_SDW_STREAMS];
> +	struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
>  };
>  
>  static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
> 

Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>

  reply	other threads:[~2020-10-29  0:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 14:20 [PATCH] ASoC: qcom: sm8250: Fix array out of bounds access Srinivas Kandagatla
2020-10-28 14:20 ` Srinivas Kandagatla
2020-10-28 14:24 ` Colin Ian King [this message]
2020-10-28 14:24   ` Colin Ian King
2020-10-28 21:22 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fc6b58a-e3e6-b57e-7ae7-16fd32392bcb@canonical.com \
    --to=colin.king@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.