[alsa-devel] [PATCH] ASoC: SOF: topology: fix get control data return type and arguments

Mark Brown broonie at kernel.org
Wed Aug 21 14:59:56 CEST 2019


On Wed, Aug 21, 2019 at 03:32:52PM +0300, Jaska Uimonen wrote:

> +static int sof_get_control_data(struct snd_sof_dev *sdev,
> +				struct snd_soc_dapm_widget *widget,
> +				struct sof_widget_data *wdata,
> +				size_t *size)
>  {
>  	const struct snd_kcontrol_new *kc;
>  	struct soc_mixer_control *sm;
>  	struct soc_bytes_ext *sbe;
>  	struct soc_enum *se;
> -	size_t size = 0;
>  	int i;


> -		size += wdata[i].pdata->size;
> +		/* don't accept 0 size for data */
> +		if (!wdata[i].pdata->size)
> +			return -EINVAL;

This should really be a separate change.

> +
> +		*size += wdata[i].pdata->size;

We appear to be requiring that the size passed in is zero initialized
which is a bit unusual and seems likely to break even if it happens to
work right now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20190821/5381e92c/attachment.sig>


More information about the Alsa-devel mailing list