Re: [PATCH] posix-clock: drop code duplication using compat_ptr_ioctl
From: Cyrill Gorcunov
Date: Tue Jan 21 2025 - 13:19:53 EST
On Tue, Jan 21, 2025 at 01:48:23PM +0100, Thomas Weißschuh wrote:
...
> > Yeah, and the PTP_ENABLE_PPS/PTP_ENABLE_PPS2 consider `arg` as 0/1 flip-flop
> > so compat_ptr won't screw it. So I personally would rather stick with a more
> > simple code (taking into account that ptp is the only real underlied device
> > so far sitting in code for so long).
>
> It is valid to pass any value to these ioctls, not only booleans.
> On s390 the value 0x80000000 aka BIT(31) would interpreted as "true" by
> a native 32bit kernel and "false" by a 64bit kernel in compat mode.
Heh, indeed, I managed to forget that s390 clears the top bit and been scratching
my head thinking of how losing the sign bit is possible)
>
> It's indeed an edge case.
> Personally I prefer the correct solution.
The correct solution is better, without a doubt. Thanks for looking into the
patch, Thomas!