public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] posix-clock: drop code duplication using compat_ptr_ioctl
Date: Tue, 21 Jan 2025 01:30:11 +0300	[thread overview]
Message-ID: <Z47Ocx8ogqJGmGbC@grain> (raw)
In-Reply-To: <4229b992-77ef-404d-b045-8f1ccad1035a@t-8ch.de>

On Mon, Jan 20, 2025 at 11:22:52PM +0100, Thomas Weißschuh wrote:
...
> > -#ifdef CONFIG_COMPAT
> > -	.compat_ioctl	= posix_clock_compat_ioctl,
> > -#endif
> > +	.compat_ioctl	= compat_ptr_ioctl,
> 
> This is not correct on s390. (It wasn't before either, though)
> The improved patch below is in my personal queue, but I didn't get
> around to actually testing and submitting it yet.

Hi, Thomas! Thanks for looking into the patch! I somehow miss why it won't
work 'cause compat_ptr_ioctl already does the same conversion as in your
code below, no? I miss something obvious?

```
long compat_ptr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	if (!file->f_op->unlocked_ioctl)
		return -ENOIOCTLCMD;

	return file->f_op->unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
}
EXPORT_SYMBOL(compat_ptr_ioctl);
```

> +#ifdef CONFIG_COMPAT
> +long ptp_compat_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
> +		      unsigned long arg)
> +{
> +	switch (cmd) {
> +	case PTP_ENABLE_PPS:
> +	case PTP_ENABLE_PPS2:
> +		/* These take in scalar arg, do not convert */
> +		break;
> +	default:
> +		arg = (unsigned long)compat_ptr(arg);

Here^^^

> +	}
> +
> +	return ptp_ioctl(pccontext, cmd, arg);
> +}
> +#endif

  reply	other threads:[~2025-01-20 22:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 22:10 [PATCH] posix-clock: drop code duplication using compat_ptr_ioctl Cyrill Gorcunov
2025-01-20 22:22 ` Thomas Weißschuh
2025-01-20 22:30   ` Cyrill Gorcunov [this message]
2025-01-20 22:41     ` Thomas Weißschuh
2025-01-21  6:48       ` Cyrill Gorcunov
2025-01-21 12:48         ` Thomas Weißschuh
2025-01-21 18:16           ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z47Ocx8ogqJGmGbC@grain \
    --to=gorcunov@gmail.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox