diff mbox series

[v2,3/6] powerpc/pkeys: fix calculation of total pkeys.

Message ID 1528936144-6696-4-git-send-email-linuxram@us.ibm.com (mailing list archive)
State Superseded
Headers show
Series powerpc/pkeys: fixes to pkeys | expand

Commit Message

Ram Pai June 14, 2018, 12:29 a.m. UTC
Total number of pkeys calculation is off by 1. Fix it.

CC: Florian Weimer <fweimer@redhat.com>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 arch/powerpc/mm/pkeys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Michael Ellerman June 19, 2018, 12:40 p.m. UTC | #1
Ram Pai <linuxram@us.ibm.com> writes:

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

Oops.

Fixes: 4fb158f65ac5 ("powerpc: track allocation status of all pkeys")
Cc: stable@vger.kernel.org # v4.16+

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index 6529f4e..b681bec 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);