[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Dec 2019 18:21:58 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Christoph Hellwig <hch@...radead.org>
Cc: Jens Axboe <axboe@...nel.dk>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Borislav Petkov <bp@...en8.de>,
"David S. Miller" <davem@...emloft.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
y2038 Mailman List <y2038@...ts.linaro.org>,
Hannes Reinecke <hare@...e.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-block <linux-block@...r.kernel.org>,
IDE-ML <linux-ide@...r.kernel.org>
Subject: Re: [PATCH 20/24] compat_ioctl: move HDIO ioctl handling into drivers/ide
On Thu, Dec 12, 2019 at 5:29 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> > +static int put_user_long(long val, unsigned long arg)
> > +{
> > +#ifdef CONFIG_COMPAT
> > + if (in_compat_syscall())
> > + return put_user(val, (compat_long_t __user *)compat_ptr(arg));
> > +#endif
> > + return put_user(val, (long __user *)arg);
> > +}
>
> We had this
>
> #ifdef CONFIG_COMPAT
> if (in_compat_syscall())
> ...
> ...
> #endif
>
> patter quite frequently. Can we define a in_compat_syscall stub
> and make sure compat_ptr and the compat_* types are available available
> to clean this up a bit?
in_compat_syscall() already has a reasonable stub, what was missing
when I created this series is the compat_long_t definition and
the compat_ptr() helper.
With patch 01/24, we can rely on the types, but I still need to add
a generic compat_ptr() implementation for non-s390 to remove the
#ifdef here.
That is probably a good idea anyway, it just needs a bit of testing.
The last time I tried this, I ran into problems with the order of compat
header inclusions on some architectures.
I've made a prototype now, will see how it goes.
> > - if (NULL == (void *) arg) {
> > + if (NULL == argp) {
>
> if (!argp) {
>
> ?
changed now.
Arnd
Powered by blists - more mailing lists