X-Git-Url: http://bbs.cooldavid.org/git/?a=blobdiff_plain;f=lib%2Fradix-tree.c;h=0ccbcdf75000999d0e0eb2f77fc4ced4c1dac13e;hb=a6b9b4d50f492630443b38404d1f436b3b748c14;hp=e907858498a6a3184f57de0d60fe25098ec37006;hpb=0d6ffdb8f151a2b685c7b45bde7ab2d49fc1bb00;p=net-next-2.6.git diff --git a/lib/radix-tree.c b/lib/radix-tree.c index e907858498a..0ccbcdf7500 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -49,7 +49,7 @@ struct radix_tree_node { unsigned int height; /* Height from the bottom */ unsigned int count; struct rcu_head rcu_head; - void *slots[RADIX_TREE_MAP_SIZE]; + void __rcu *slots[RADIX_TREE_MAP_SIZE]; unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; }; @@ -625,6 +625,8 @@ EXPORT_SYMBOL(radix_tree_tag_get); * * The function returns number of leaves where the tag was set and sets * *first_indexp to the first unscanned index. + * WARNING! *first_indexp can wrap if last_index is ULONG_MAX. Caller must + * be prepared to handle that. */ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, 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, next: /* Go to next item at level determined by 'shift' */ index = ((index >> shift) + 1) << shift; - if (index > last_index) + /* Overflow can happen when last_index is ~0UL... */ + if (index > last_index || !index) break; if (tagged >= nr_to_tag) break;