[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180918175952.GJ11367@ziepe.ca>
Date: Tue, 18 Sep 2018 11:59:52 -0600
From: Jason Gunthorpe <jgg@...pe.ca>
To: Darren Hart <dvhart@...radead.org>
Cc: Al Viro <viro@...iv.linux.org.uk>, Arnd Bergmann <arnd@...db.de>,
linux-fsdevel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"David S. Miller" <davem@...emloft.net>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
qat-linux@...el.com, linux-crypto@...r.kernel.org,
linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org, amd-gfx@...ts.freedesktop.org,
linux-input@...r.kernel.org, linux-iio@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-nvdimm@...ts.01.org,
linux-nvme@...ts.infradead.org, linux-pci@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-remoteproc@...r.kernel.org, sparclinux@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-usb@...r.kernel.org,
linux-fbdev@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-btrfs@...r.kernel.org, ceph-devel@...r.kernel.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 05/17] compat_ioctl: move more drivers to
generic_compat_ioctl_ptrarg
On Tue, Sep 18, 2018 at 10:51:08AM -0700, Darren Hart wrote:
> On Fri, Sep 14, 2018 at 09:57:48PM +0100, Al Viro wrote:
> > On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote:
> >
> > > Acked-by: Darren Hart (VMware) <dvhart@...radead.org>
> > >
> > > As for a longer term solution, would it be possible to init fops in such
> > > a way that the compat_ioctl call defaults to generic_compat_ioctl_ptrarg
> > > so we don't have to duplicate this boilerplate for every ioctl fops
> > > structure?
> >
> > Bad idea, that... Because several years down the road somebody will add
> > an ioctl that takes an unsigned int for argument. Without so much as looking
> > at your magical mystery macro being used to initialize file_operations.
>
> Fair, being explicit in the declaration as it is currently may be
> preferable then.
It would be much cleaner and safer if you could arrange things to add
something like this to struct file_operations:
long (*ptr_ioctl) (struct file *, unsigned int, void __user *);
Where the core code automatically converts the unsigned long to the
void __user * as appropriate.
Then it just works right always and the compiler will help address
Al's concern down the road.
Cheers,
Jason
Powered by blists - more mailing lists