From: Takashi Iwai Subject: Re: [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel Date: Mon, 07 Dec 2015 10:52:16 +0100 Message-ID: References: <1449470311-32394-1-git-send-email-rlokhande@nvidia.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 28895265898 for ; Mon, 7 Dec 2015 10:52:18 +0100 (CET) In-Reply-To: <1449470311-32394-1-git-send-email-rlokhande@nvidia.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Ravindra Lokhande Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Mon, 07 Dec 2015 07:38:31 +0100, Ravindra Lokhande wrote: > > Compress offload does not support ioctl calls from a 32bit userspace > in a 64 bit kernel. This patch adds support for ioctls from a 32bit > userspace in a 64bit kernel > > Signed-off-by: Ravindra Lokhande > --- > > v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer > v2 -> v3: add header file compat.h Applied now with Vinod's ack. Thanks. Takashi > > sound/core/compress_offload.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c > index b123c42..4597820 100644 > --- a/sound/core/compress_offload.c > +++ b/sound/core/compress_offload.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -847,6 +848,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) > return retval; > } > > +/* support of 32bit userspace on 64bit platforms */ > +#ifdef CONFIG_COMPAT > +static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd, > + unsigned long arg) > +{ > + return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); > +} > +#endif > + > static const struct file_operations snd_compr_file_ops = { > .owner = THIS_MODULE, > .open = snd_compr_open, > @@ -854,6 +864,9 @@ static const struct file_operations snd_compr_file_ops = { > .write = snd_compr_write, > .read = snd_compr_read, > .unlocked_ioctl = snd_compr_ioctl, > +#ifdef CONFIG_COMPAT > + .compat_ioctl = snd_compr_ioctl_compat, > +#endif > .mmap = snd_compr_mmap, > .poll = snd_compr_poll, > }; > -- > 2.1.4 > >