1 #ifndef _LINUX_PKEYS_H 2 #define _LINUX_PKEYS_H 3 4 #include <linux/mm_types.h> 5 #include <asm/mmu_context.h> 6 7 #ifdef CONFIG_ARCH_HAS_PKEYS 8 #include <asm/pkeys.h> 9 #else /* ! CONFIG_ARCH_HAS_PKEYS */ 10 #define arch_max_pkey() (1) 11 #endif /* ! CONFIG_ARCH_HAS_PKEYS */ 12 13 /* 14 * This is called from mprotect_pkey(). 15 * 16 * Returns true if the protection keys is valid. 17 */ 18 static inline bool validate_pkey(int pkey) 19 { 20 if (pkey < 0) 21 return false; 22 return (pkey < arch_max_pkey()); 23 } 24 25 #endif /* _LINUX_PKEYS_H */ 26