aboutsummaryrefslogtreecommitdiffstats
path: root/lib/radix-tree.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2006-06-23 05:03:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:49 -0400
commit4c91c3648c620003cb7b21b8858f36cd6132e168 (patch)
tree6572fedb9a18ba0b31695f1ba30a219621b6f20a /lib/radix-tree.c
parent58ce1fd5805647a58a050bbbbd2252ea5ecb47b3 (diff)
[PATCH] buglet in radix_tree_tag_set
The comment states: 'Setting a tag on a not-present item is a BUG.' Hence if 'index' is larger than the maxindex; the item _cannot_ be presen; it should also be a BUG. Also, this allows the following statement (assume a fresh tree): radix_tree_tag_set(root, 16, 1); to fail silently, but when preceded by: radix_tree_insert(root, 32, item); it would BUG, because the height has been extended by the insert. In neither case was 16 present. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/radix-tree.c')
-rw-r--r--lib/radix-tree.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 7cbdada51049..b32efae7688e 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -389,8 +389,7 @@ void *radix_tree_tag_set(struct radix_tree_root *root,
389 struct radix_tree_node *slot; 389 struct radix_tree_node *slot;
390 390
391 height = root->height; 391 height = root->height;
392 if (index > radix_tree_maxindex(height)) 392 BUG_ON(index > radix_tree_maxindex(height));
393 return NULL;
394 393
395 slot = root->rnode; 394 slot = root->rnode;
396 shift = (height - 1) * RADIX_TREE_MAP_SHIFT; 395 shift = (height - 1) * RADIX_TREE_MAP_SHIFT;