* [PATCH] buglet in radix_tree_tag_set
@ 2006-04-28 16:13 Peter Zijlstra
0 siblings, 0 replies; only message in thread
From: Peter Zijlstra @ 2006-04-28 16:13 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Nick Piggin
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
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>
lib/radix-tree.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: linux-2.6/lib/radix-tree.c
===================================================================
--- linux-2.6.orig/lib/radix-tree.c 2006-04-07 10:54:43.000000000 +0200
+++ linux-2.6/lib/radix-tree.c 2006-04-28 17:56:14.000000000 +0200
@@ -365,8 +365,7 @@ void *radix_tree_tag_set(struct radix_tr
struct radix_tree_node *slot;
height = root->height;
- if (index > radix_tree_maxindex(height))
- return NULL;
+ BUG_ON(index > radix_tree_maxindex(height))
shift = (height - 1) * RADIX_TREE_MAP_SHIFT;
slot = root->rnode;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-04-28 16:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-28 16:13 [PATCH] buglet in radix_tree_tag_set Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox