Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pkeys: Fix calculation of total pkeys.

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

Fixes: 4fb158f65ac5 ("powerpc: track allocation status of all pkeys")
Cc: stable@vger.kernel.org # v4.16+
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Ram Pai and committed by
Michael Ellerman
fe6a2804 c76662e8

+1 -1
+1 -1
arch/powerpc/mm/pkeys.c
··· 92 92 * arch-neutral code. 93 93 */ 94 94 pkeys_total = min_t(int, pkeys_total, 95 - (ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT)); 95 + ((ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT)+1)); 96 96 97 97 if (!pkey_mmu_enabled() || radix_enabled() || !pkeys_total) 98 98 static_branch_enable(&pkey_disabled);