sparc/mm: fix MAX_ORDER usage in tsb_grow()
[platform/kernel/linux-starfive.git] / arch / sparc / mm / tsb.c
index 9122057..dba8dff 100644 (file)
@@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
        unsigned long new_rss_limit;
        gfp_t gfp_flags;
 
-       if (max_tsb_size > (PAGE_SIZE << MAX_ORDER))
-               max_tsb_size = (PAGE_SIZE << MAX_ORDER);
+       if (max_tsb_size > (PAGE_SIZE << (MAX_ORDER - 1)))
+               max_tsb_size = (PAGE_SIZE << (MAX_ORDER - 1));
 
        new_cache_index = 0;
        for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {