Re: [LV] [PATCH] avoid negative shifts in radix-tree.c

2007-08-26 Thread Jan-Benedict Glaw
On Sat, 2007-08-25 16:26:07 +0200, Peter Firefly Lund <[EMAIL PROTECTED]> wrote:
> --- lib/radix-tree-old.c  2007-08-25 15:36:40.0 +0200
> +++ lib/radix-tree.c  2007-08-25 15:36:51.0 +0200
> @@ -980,12 +980,14 @@ radix_tree_node_ctor(void *node, struct 
>  
>  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 inttmp   = 
> + int shift = RADIX_TREE_INDEX_BITS - height * RADIX_TREE_MAP_SHIFT;
> + unsigned long   index;
> +
> + if (shift < 0)
> + return ~0UL;
> + else
> + return ~0UL >> shift;
>  }
>  
>  static __init void radix_tree_init_maxindex(void)

`index' seems to be unused now?  And indention does neither follow
kernel coding style, nor this file's style. You'd also hammer out
`tmp' and put its initializer right there where it's used.

MfG, JBG

-- 
  Jan-Benedict Glaw  [EMAIL PROTECTED]  +49-172-7608481
Signature of:   Träume nicht von Dein Leben: Lebe Deinen Traum!
the second  :


signature.asc
Description: Digital signature


Re: [LV] [PATCH] avoid negative shifts in radix-tree.c

2007-08-26 Thread Jan-Benedict Glaw
On Sat, 2007-08-25 16:26:07 +0200, Peter Firefly Lund [EMAIL PROTECTED] wrote:
 --- lib/radix-tree-old.c  2007-08-25 15:36:40.0 +0200
 +++ lib/radix-tree.c  2007-08-25 15:36:51.0 +0200
 @@ -980,12 +980,14 @@ radix_tree_node_ctor(void *node, struct 
  
  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 inttmp   = 
 + int shift = RADIX_TREE_INDEX_BITS - height * RADIX_TREE_MAP_SHIFT;
 + unsigned long   index;
 +
 + if (shift  0)
 + return ~0UL;
 + else
 + return ~0UL  shift;
  }
  
  static __init void radix_tree_init_maxindex(void)

`index' seems to be unused now?  And indention does neither follow
kernel coding style, nor this file's style. You'd also hammer out
`tmp' and put its initializer right there where it's used.

MfG, JBG

-- 
  Jan-Benedict Glaw  [EMAIL PROTECTED]  +49-172-7608481
Signature of:   Träume nicht von Dein Leben: Lebe Deinen Traum!
the second  :


signature.asc
Description: Digital signature