mm/shmem.c: fix judgment error in shmem_is_huge()
[sfrench/cifs-2.6.git] / mm / shmem.c
index 88742953532cce47eaf63200eaf26fac10c6b6f6..b5860f4a2738ee3861e30bd4e506578a0f9218ba 100644 (file)
@@ -490,9 +490,9 @@ bool shmem_is_huge(struct vm_area_struct *vma,
        case SHMEM_HUGE_ALWAYS:
                return true;
        case SHMEM_HUGE_WITHIN_SIZE:
-               index = round_up(index, HPAGE_PMD_NR);
+               index = round_up(index + 1, HPAGE_PMD_NR);
                i_size = round_up(i_size_read(inode), PAGE_SIZE);
-               if (i_size >= HPAGE_PMD_SIZE && (i_size >> PAGE_SHIFT) >= index)
+               if (i_size >> PAGE_SHIFT >= index)
                        return true;
                fallthrough;
        case SHMEM_HUGE_ADVISE: