Re: [PATCH V8 16/44] mm/pkeys: Introduce pks_mk_readwrite()

Edgecombe, Rick P
2022-01-31T23:10:53Z

On Thu, 2022-01-27 at 09:54 -0800, ira.weiny@intel.com wrote:
> +void pks_update_protection(int pkey, u32 protection)
> +{

I don't know if this matters too much, but the type of a pkey is either
int or u16 across this series and PKU. But it's only possibly a 4 bit
value. Seems the smallest that would fit is char. Why use one over the
other?

Also, why u32 for protection here? The whole pkrs value containing the
bits for all keys is 32 bits, but per key there is only room ever for 2
bits, right?

It would be nice to be consistent and have a reason, but again, I don't
know if makes any real difference.