[PATCH v3 5/9] powerpc/pkeys: fix calculation of total pkeys.

Ram Pai linuxram at us.ibm.com
Tue Jul 17 23:51:06 AEST 2018


Total number of pkeys calculation is off by 1. Fix it.

Cc: Florian Weimer <fweimer at redhat.com>
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: Thiago Jung Bauermann <bauerman at linux.ibm.com>
Fixes: 4fb158f65ac5 ("powerpc: track allocation status of all pkeys")
Cc: stable at vger.kernel.org # v4.16+
Signed-off-by: Ram Pai <linuxram at us.ibm.com>
---
 arch/powerpc/mm/pkeys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index cd0e623..7db56d8 100644
--- a/arch/powerpc/mm/pkeys.c
+++ b/arch/powerpc/mm/pkeys.c
@@ -92,7 +92,7 @@ int pkey_initialize(void)
 	 * arch-neutral code.
 	 */
 	pkeys_total = min_t(int, pkeys_total,
-			(ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT));
+			((ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT)+1));
 
 	if (!pkey_mmu_enabled() || radix_enabled() || !pkeys_total)
 		static_branch_enable(&pkey_disabled);
-- 
1.7.1



More information about the Linuxppc-dev mailing list