Merge remote-tracking branch 'stable/linux-5.15.y' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / mm / mempolicy.c
index 9db0158..4472be6 100644 (file)
@@ -1389,7 +1389,7 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
                unsigned long bits = min_t(unsigned long, maxnode, BITS_PER_LONG);
                unsigned long t;
 
-               if (get_bitmap(&t, &nmask[maxnode / BITS_PER_LONG], bits))
+               if (get_bitmap(&t, &nmask[(maxnode - 1) / BITS_PER_LONG], bits))
                        return -EFAULT;
 
                if (maxnode - bits >= MAX_NUMNODES) {