[alsa-devel] [PATCH] ASoC: fsl: expand the size of the name in fsl_ssi_private struct

David Laight David.Laight at ACULAB.COM
Thu May 23 12:21:19 CEST 2013


> strcpy(ssi_private->name, p) in probe() sets "name" by "p", gotten from dts,
> while the length of "p", if the devicetree node name of SSI is commonly set,
> would always be larger than 1 char size, so need a larger size for "name".

Are you sure this isn't allowed for when the structure is allocated?
Otherwise you also need to use strlcpy() as well.

> @@ -152,5 +152,5 @@ struct fsl_ssi_private {
>  	} stats;
> 
> -	char name[1];
> +	char name[32];
>  };

This looks like what c99 allows 'char name[0]' be used for.
But ensure the \0 is allowed for before changing to 1 to 0.

	David





More information about the Alsa-devel mailing list