x86/pkeys: Skip 'init_pkru' debugfs file creation when pkeys not supported
[linux-2.6-microblaze.git] / arch / x86 / mm / pkeys.c
index a2332ee..4a67b92 100644 (file)
@@ -192,6 +192,10 @@ static const struct file_operations fops_init_pkru = {
 
 static int __init create_init_pkru_value(void)
 {
+       /* Do not expose the file if pkeys are not supported. */
+       if (!cpu_feature_enabled(X86_FEATURE_OSPKE))
+               return 0;
+
        debugfs_create_file("init_pkru", S_IRUSR | S_IWUSR,
                        arch_debugfs_dir, NULL, &fops_init_pkru);
        return 0;