]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
hugetlb: fix/remove uninitialized variable in remove_inode_hugepages
authorMike Kravetz <mike.kravetz@oracle.com>
Fri, 26 Aug 2022 05:03:28 +0000 (22:03 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Aug 2022 05:03:28 +0000 (22:03 -0700)
Code introduced for the routine remove_inode_hugepages by patch "hugetlb:
handle truncate racing with page faults", incorrectly uses a variable
m_index.  This is a remnant from a previous version of the code when under
development.  Use the correct variable 'index' and remove 'm_index' from
the routine.

Link: https://lkml.kernel.org/r/Ywepr7C2X20ZvLdn@monkey
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/hugetlbfs/inode.c

index e83fd31671b32201098bdfe03d72bbb2f174dad8..5d85b12b35a8f3ee3851f191dcf09a9f9f2d350f 100644 (file)
@@ -537,7 +537,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
        const pgoff_t start = lstart >> huge_page_shift(h);
        const pgoff_t end = lend >> huge_page_shift(h);
        pgoff_t m_end = lm_end >> huge_page_shift(h);
-       pgoff_t m_start, m_index;
+       pgoff_t m_start;
        struct folio_batch fbatch;
        struct folio *folio;
        pgoff_t next, index;
@@ -559,7 +559,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
                         * due to a race with fault code.
                         */
                        freed += fault_lock_inode_indicies(h, inode, mapping,
-                                               m_start, m_index, truncate_op);
+                                               m_start, index, truncate_op);
 
                        /*
                         * Remove folio that was part of folio_batch.