[alsa-devel] [RFC 4/5] compress: add the core file

Dimitris Papastamos dp at opensource.wolfsonmicro.com
Wed Sep 7 16:12:07 CEST 2011


On Wed, Sep 07, 2011 at 02:59:27PM +0100, Dimitris Papastamos wrote:
> On Fri, Sep 02, 2011 at 11:36:24AM +0530, Vinod Koul wrote:
> > This patch ads core.c, the file which implements the ioctls and
> > registers the devices
> > 
> > Signed-off-by: Vinod Koul <vinod.koul at linux.intel.com>
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> > ---
> >  sound/compress_offload/core.c |  632 +++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 632 insertions(+), 0 deletions(-)
> >  create mode 100644 sound/compress_offload/core.c
> > 
> > diff --git a/sound/compress_offload/core.c b/sound/compress_offload/core.c
> > new file mode 100644
> > index 0000000..1797dba
> > --- /dev/null
> 
> > +static int snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
> > +{
> > +	struct snd_compr_params *params;
> > +	int retval;
> > +
> > +	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
> > +		/*
> > +		 * we should allow parameter change only when stream has been
> > +		 * opened not in other cases
> > +		 */
> > +		params = kmalloc(sizeof(*params), GFP_KERNEL);
> > +		if (!params)
> > +			return -ENOMEM;
> > +		if (copy_from_user(&params, (void __user *)arg, sizeof(params)))
> > +			return -EFAULT;
> 
> This should be copy_from_user(params, ...) and not &params.

Aw and it should be sizeof(*params).

Thanks,
Dimitris


More information about the Alsa-devel mailing list