[alsa-devel] Question on compress offload framework memory corruption

gsantosh at codeaurora.org gsantosh at codeaurora.org
Wed Dec 18 14:17:51 CET 2013


Hi,

I have following questions in the compressed offload framework API.

static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
					struct snd_compr_params *params)
{
...
	hw_params = kzalloc(sizeof(*hw_params), GFP_KERNEL);
	if (hw_params == NULL)
		return -ENOMEM;
/*1st question is, what is the use of above allocated memory I do not see
this being used in this function*/

...

	memcpy(&fe->dpcm[fe_substream->stream].hw_params, params,
			sizeof(struct snd_pcm_hw_params));

/* 2nd question is
in above memcpy there is parameter mismatch
&fe->dpcm[fe_substream->stream].hw_params is of structure type struct
snd_pcm_hw_params

params argument is of the structure type struct snd_compr_params
the definition of the two structures are different, how this is working?
this will over right the destination with junk value which will return
in error when this memory is accessed, after memcpy this cpu_dai hw_params
returing with EINVAL error, please explain why this is done this way.
*/

...

}

Regards,
Santosh M G.





More information about the Alsa-devel mailing list