Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Niranjan H Y <niranjan.hy@ti.com>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org,
	mstrozek@opensource.cirrus.com, yung-chuan.liao@linux.intel.com,
	linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, cezary.rojewski@intel.com,
	peter.ujfalusi@linux.intel.com,
	ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
	pierre-louis.bossart@linux.dev, navada@ti.com,
	shenghao-ding@ti.com, v-hampiholi@ti.com, baojun.xu@ti.com,
	dan.carpenter@linaro.org
Subject: Re: [PATCH v1] ASoC: SDCA: bug fix while parsing mipi-sdca-control-cn-list
Date: Mon, 10 Nov 2025 13:48:38 +0000	[thread overview]
Message-ID: <aRHtNhYBQpABJjJq@opensource.cirrus.com> (raw)
In-Reply-To: <20251110130058.818-1-niranjan.hy@ti.com>

On Mon, Nov 10, 2025 at 06:30:58PM +0530, Niranjan H Y wrote:
> "struct sdca_control" declares "values" field as integer array.
> But the memory allocated to it is of char array. This causes
> crash for sdca_parse_function API. This patch addresses the
> issue by allocating correct data size.
> 
> Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
> ---

Thanks very much for spotting this.

>  sound/soc/sdca/sdca_functions.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
> index b2e3fab9b..6975c71a9 100644
> --- a/sound/soc/sdca/sdca_functions.c
> +++ b/sound/soc/sdca/sdca_functions.c
> @@ -950,7 +950,8 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
>  		return ret;
>  	}
>  
> -	control->values = devm_kzalloc(dev, hweight64(control->cn_list), GFP_KERNEL);
> +	control->values = devm_kzalloc(dev, hweight64(control->cn_list) * sizeof(int),
> +				       GFP_KERNEL);

Should probably switch to devm_kcalloc, rather than doing the
multiply manually.

Thanks,
Charles

>  	if (!control->values)
>  		return -ENOMEM;
>  
> -- 
> 2.25.1
> 

      reply	other threads:[~2025-11-10 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 13:00 [PATCH v1] ASoC: SDCA: bug fix while parsing mipi-sdca-control-cn-list Niranjan H Y
2025-11-10 13:48 ` Charles Keepax [this message]

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=aRHtNhYBQpABJjJq@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=mstrozek@opensource.cirrus.com \
    --cc=navada@ti.com \
    --cc=niranjan.hy@ti.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    --cc=v-hampiholi@ti.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox