For powerpc, PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS are
redefined only if the system headers already define them.
Otherwise, the test fails to compile due to their absence.
This makes sure that they are always defined irrespective of
them being present in the system headers.

Fixes: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support")
Reported-by: Aneesh Kumar K.V <aneesh.ku...@linux.ibm.com>
Signed-off-by: Sandipan Das <sandi...@linux.ibm.com>
---
 tools/testing/selftests/vm/pkey-powerpc.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/vm/pkey-powerpc.h 
b/tools/testing/selftests/vm/pkey-powerpc.h
index 3a761e51a587..eb5077de8f1e 100644
--- a/tools/testing/selftests/vm/pkey-powerpc.h
+++ b/tools/testing/selftests/vm/pkey-powerpc.h
@@ -16,15 +16,11 @@
 #define fpregs                 fp_regs
 #define si_pkey_offset         0x20
 
-#ifdef PKEY_DISABLE_ACCESS
 #undef PKEY_DISABLE_ACCESS
-# define PKEY_DISABLE_ACCESS   0x3  /* disable read and write */
-#endif
+#define PKEY_DISABLE_ACCESS    0x3  /* disable read and write */
 
-#ifdef PKEY_DISABLE_WRITE
 #undef PKEY_DISABLE_WRITE
-# define PKEY_DISABLE_WRITE    0x2
-#endif
+#define PKEY_DISABLE_WRITE     0x2
 
 #define NR_PKEYS               32
 #define NR_RESERVED_PKEYS_4K   27 /* pkey-0, pkey-1, exec-only-pkey
-- 
2.17.1

Reply via email to