[PATCH] 64 bit bug in radix-tree lookup.
From: Martin Schwidefsky (schwidefsky_at_de.ibm.com)
Date: 06/30/04
- Previous message: Martin Schwidefsky: "Patches for -bk/-mm4."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 19:07:04 +0200 To: akpm@osdl.org, linux-kernel@vger.kernel.org
[PATCH] 64 bit bug in radix-tree lookup.
The radix tree functions __lookup and __lookup_tag uses (1 << shift)
in their index calculations. On 64 bit systems the shift can be
bigger than 32. The shift of an integer by more than 32 bits evaluates
to zero which causes the lookup to fail.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
diffstat:
lib/radix-tree.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff -urN linux-2.6/lib/radix-tree.c linux-2.6-s390/lib/radix-tree.c
--- linux-2.6/lib/radix-tree.c Wed Jun 30 17:06:23 2004
+++ linux-2.6-s390/lib/radix-tree.c Wed Jun 30 17:06:32 2004
@@ -494,8 +494,8 @@
for ( ; i < RADIX_TREE_MAP_SIZE; i++) {
if (slot->slots[i] != NULL)
break;
- index &= ~((1 << shift) - 1);
- index += 1 << shift;
+ index &= ~((1UL << shift) - 1);
+ index += 1UL << shift;
if (index == 0)
goto out; /* 32-bit wraparound */
}
@@ -584,8 +584,8 @@
BUG_ON(slot->slots[i] == NULL);
break;
}
- index &= ~((1 << shift) - 1);
- index += 1 << shift;
+ index &= ~((1UL << shift) - 1);
+ index += 1UL << shift;
if (index == 0)
goto out; /* 32-bit wraparound */
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Martin Schwidefsky: "Patches for -bk/-mm4."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|