[PATCH v15 06/23] selftests/vm/pkeys: Typecast the pkey register

Michael Ellerman mpe at ellerman.id.au
Thu Dec 19 22:39:44 AEDT 2019


Dave Hansen <dave.hansen at intel.com> writes:
> On 12/18/19 12:59 PM, Michal Suchánek wrote:
>>> I'd really just rather do %016lx *everywhere* than sprinkle the
>>> PKEY_REG_FMTs around.
>> Does lx work with u32 without warnings?
>
> Either way, I'd be happy to just make the x86 one u64 to make the whole
> thing look more sane,

It's userspace so you don't get u64, you only get __u64.

And then you'll hit the fact that by default __u64 is unsigned long on
powerpc and unsigned long long on x86, meaning you still can't use the
same printf specifier.

To avoid that you should define __SANE_USERSPACE_TYPES__ before
including any headers, and then you'll get unsigned long long for __u64
everywhere and you can just use %llx.

cheers


More information about the Linuxppc-dev mailing list