diff --git a/[refs] b/[refs] index 83c315d79fb6..7ed8ab7cd48e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22e48eaf587d044ba311a73c6fe0d0deaa8fdb63 +refs/heads/master: 430d275a399175c7c0673459738979287ec1fd22 diff --git a/trunk/lib/radix-tree.c b/trunk/lib/radix-tree.c index 53fd44d78716..48c250fe2233 100644 --- a/trunk/lib/radix-tree.c +++ b/trunk/lib/radix-tree.c @@ -1049,12 +1049,14 @@ radix_tree_node_ctor(struct kmem_cache *cachep, void *node) static __init unsigned long __maxindex(unsigned int height) { - unsigned int tmp = height * RADIX_TREE_MAP_SHIFT; - unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1; - - if (tmp >= RADIX_TREE_INDEX_BITS) - index = ~0UL; - return index; + unsigned int width = height * RADIX_TREE_MAP_SHIFT; + int shift = RADIX_TREE_INDEX_BITS - width; + + if (shift < 0) + return ~0UL; + if (shift >= BITS_PER_LONG) + return 0UL; + return ~0UL >> shift; } static __init void radix_tree_init_maxindex(void)