From: Peter Zijlstra <peter@programming.kicks-ass.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Nick Piggin <nickpiggin@yahoo.com.au>
Subject: [PATCH] buglet in radix_tree_tag_set
Date: Fri, 28 Apr 2006 18:13:42 +0200 [thread overview]
Message-ID: <1146240822.4932.3.camel@lappy> (raw)
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;
reply other threads:[~2006-04-28 16:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1146240822.4932.3.camel@lappy \
--to=peter@programming.kicks-ass.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox