aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/radix-tree.c5
-rw-r--r--mm/page-writeback.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index e907858498a6..5b7d4623f0b7 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -625,6 +625,8 @@ EXPORT_SYMBOL(radix_tree_tag_get);
625 * 625 *
626 * The function returns number of leaves where the tag was set and sets 626 * The function returns number of leaves where the tag was set and sets
627 * *first_indexp to the first unscanned index. 627 * *first_indexp to the first unscanned index.
628 * WARNING! *first_indexp can wrap if last_index is ULONG_MAX. Caller must
629 * be prepared to handle that.
628 */ 630 */
629unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, 631unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
630 unsigned long *first_indexp, unsigned long last_index, 632 unsigned long *first_indexp, unsigned long last_index,
@@ -675,7 +677,8 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
675next: 677next:
676 /* Go to next item at level determined by 'shift' */ 678 /* Go to next item at level determined by 'shift' */
677 index = ((index >> shift) + 1) << shift; 679 index = ((index >> shift) + 1) << shift;
678 if (index > last_index) 680 /* Overflow can happen when last_index is ~0UL... */
681 if (index > last_index || !index)
679 break; 682 break;
680 if (tagged >= nr_to_tag) 683 if (tagged >= nr_to_tag)
681 break; 684 break;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7262aacea8a2..c09ef5219cbe 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -836,7 +836,8 @@ void tag_pages_for_writeback(struct address_space *mapping,
836 spin_unlock_irq(&mapping->tree_lock); 836 spin_unlock_irq(&mapping->tree_lock);
837 WARN_ON_ONCE(tagged > WRITEBACK_TAG_BATCH); 837 WARN_ON_ONCE(tagged > WRITEBACK_TAG_BATCH);
838 cond_resched(); 838 cond_resched();
839 } while (tagged >= WRITEBACK_TAG_BATCH); 839 /* We check 'start' to handle wrapping when end == ~0UL */
840 } while (tagged >= WRITEBACK_TAG_BATCH && start);
840} 841}
841EXPORT_SYMBOL(tag_pages_for_writeback); 842EXPORT_SYMBOL(tag_pages_for_writeback);
842 843