File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1625,14 +1625,15 @@ static int cpa_process_alias(struct cpa_data *cpa)
1625
1625
static int __change_page_attr_set_clr (struct cpa_data * cpa , int checkalias )
1626
1626
{
1627
1627
unsigned long numpages = cpa -> numpages ;
1628
- int ret ;
1628
+ unsigned long rempages = numpages ;
1629
+ int ret = 0 ;
1629
1630
1630
- while (numpages ) {
1631
+ while (rempages ) {
1631
1632
/*
1632
1633
* Store the remaining nr of pages for the large page
1633
1634
* preservation check.
1634
1635
*/
1635
- cpa -> numpages = numpages ;
1636
+ cpa -> numpages = rempages ;
1636
1637
/* for array changes, we can't use large page */
1637
1638
if (cpa -> flags & (CPA_ARRAY | CPA_PAGES_ARRAY ))
1638
1639
cpa -> numpages = 1 ;
@@ -1643,24 +1644,28 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
1643
1644
if (!debug_pagealloc_enabled ())
1644
1645
spin_unlock (& cpa_lock );
1645
1646
if (ret )
1646
- return ret ;
1647
+ goto out ;
1647
1648
1648
1649
if (checkalias ) {
1649
1650
ret = cpa_process_alias (cpa );
1650
1651
if (ret )
1651
- return ret ;
1652
+ goto out ;
1652
1653
}
1653
1654
1654
1655
/*
1655
1656
* Adjust the number of pages with the result of the
1656
1657
* CPA operation. Either a large page has been
1657
1658
* preserved or a single page update happened.
1658
1659
*/
1659
- BUG_ON (cpa -> numpages > numpages || !cpa -> numpages );
1660
- numpages -= cpa -> numpages ;
1660
+ BUG_ON (cpa -> numpages > rempages || !cpa -> numpages );
1661
+ rempages -= cpa -> numpages ;
1661
1662
cpa -> curpage += cpa -> numpages ;
1662
1663
}
1663
- return 0 ;
1664
+
1665
+ out :
1666
+ /* Restore the original numpages */
1667
+ cpa -> numpages = numpages ;
1668
+ return ret ;
1664
1669
}
1665
1670
1666
1671
/*
You can’t perform that action at this time.
0 commit comments