diff options
-rw-r--r-- | lib/radix-tree.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 53fd44d78716..48c250fe2233 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -1049,12 +1049,14 @@ radix_tree_node_ctor(struct kmem_cache *cachep, void *node) | |||
1049 | 1049 | ||
1050 | static __init unsigned long __maxindex(unsigned int height) | 1050 | static __init unsigned long __maxindex(unsigned int height) |
1051 | { | 1051 | { |
1052 | unsigned int tmp = height * RADIX_TREE_MAP_SHIFT; | 1052 | unsigned int width = height * RADIX_TREE_MAP_SHIFT; |
1053 | unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1; | 1053 | int shift = RADIX_TREE_INDEX_BITS - width; |
1054 | 1054 | ||
1055 | if (tmp >= RADIX_TREE_INDEX_BITS) | 1055 | if (shift < 0) |
1056 | index = ~0UL; | 1056 | return ~0UL; |
1057 | return index; | 1057 | if (shift >= BITS_PER_LONG) |
1058 | return 0UL; | ||
1059 | return ~0UL >> shift; | ||
1058 | } | 1060 | } |
1059 | 1061 | ||
1060 | static __init void radix_tree_init_maxindex(void) | 1062 | static __init void radix_tree_init_maxindex(void) |