[alsa-devel] [PATCH V2 1/1] ASoC: add a core API to share more product information with user space

Takashi Iwai tiwai at suse.de
Wed Mar 30 11:19:45 CEST 2016


On Wed, 30 Mar 2016 10:52:32 +0200,
han.lu at intel.com wrote:
> 
> +	/* card long name / card component */
> +	name = kstrdup(card->name, GFP_KERNEL);
> +	if (!name)
> +		return -ENOMEM;
> +	strcat(name, ":");
> +	strcat(name, card->driver_name);
> +	strcat(name, ":");
> +	if (vendor)
> +		strcat(name, vendor);
> +	strcat(name, ":");
> +	if (firmware)
> +		strcat(name, firmware);

strcat() can't be used in that way.  You'd need to allocate an enough
large string buffer, and use strlcat() to fill in.

Also, ideally check whether each name string has no colon letter
included.  Otherwise it'll confuse the parser in user space.


thanks,

Takashi


More information about the Alsa-devel mailing list