OSDN Git Service

powerpc/pkeys: Fix calculation of total pkeys.
authorRam Pai <linuxram@us.ibm.com>
Tue, 17 Jul 2018 13:51:06 +0000 (06:51 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 24 Jul 2018 11:35:09 +0000 (21:35 +1000)
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>
arch/powerpc/mm/pkeys.c

index 8f0052b..04f6597 100644 (file)
@@ -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);