mm: memory: fix shift-out-of-bounds in fault_around_bytes_set
[sfrench/cifs-2.6.git] / mm / memory.c
index abd4f33d62c94e7d3c71da6740d0d7e52a2eae60..e17669d4f72f70e9d027b97d73dcd055e423d421 100644 (file)
@@ -4776,7 +4776,8 @@ static int fault_around_bytes_set(void *data, u64 val)
         * The minimum value is 1 page, however this results in no fault-around
         * at all. See should_fault_around().
         */
-       fault_around_pages = max(rounddown_pow_of_two(val) >> PAGE_SHIFT, 1UL);
+       val = max(val, PAGE_SIZE);
+       fault_around_pages = rounddown_pow_of_two(val) >> PAGE_SHIFT;
 
        return 0;
 }