Re: [PATCH] avoid negative shifts in radix-tree.c, take 2

2007-08-29 Thread Andreas Schwab
Peter Lund <[EMAIL PROTECTED]> writes: > Shifting by more than the width of the value on the left is also not allowed. Shifting by the width of the value is not allowed as well. > --- linux-2.6.22/lib/radix-tree.c.orig2007-08-27 15:42:37.0 > +0200 > +++

[PATCH] avoid negative shifts in radix-tree.c, take 2

2007-08-29 Thread Peter Lund
From: Peter Lund <[EMAIL PROTECTED]> Negative shifts are not allowed in C (the result is undefined). It works on most platforms but not on the VAX with gcc 4.0.1 (it results in an "operand reserved" fault). Applies to Linux 2.6.22. Signed-off-by: Peter Lund <[EMAIL PROTECTED]> --- Shifting by

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

2007-08-29 Thread Maciej W. Rozycki
On Mon, 27 Aug 2007, Christoph Hellwig wrote: > The conceptual change looks fine to me, but the code looks a little odd, > what about: > > static __init unsigned long __maxindex(unsigned int height) > { > unsigned int tmp = height * RADIX_TREE_MAP_SHIFT; > int shift =

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

2007-08-29 Thread Maciej W. Rozycki
On Mon, 27 Aug 2007, Christoph Hellwig wrote: The conceptual change looks fine to me, but the code looks a little odd, what about: static __init unsigned long __maxindex(unsigned int height) { unsigned int tmp = height * RADIX_TREE_MAP_SHIFT; int shift = RADIX_TREE_INDEX_BITS

Re: [PATCH] avoid negative shifts in radix-tree.c, take 2

2007-08-29 Thread Andreas Schwab
Peter Lund [EMAIL PROTECTED] writes: Shifting by more than the width of the value on the left is also not allowed. Shifting by the width of the value is not allowed as well. --- linux-2.6.22/lib/radix-tree.c.orig2007-08-27 15:42:37.0 +0200 +++ linux-2.6.22/lib/radix-tree.c

[PATCH] avoid negative shifts in radix-tree.c, take 2

2007-08-29 Thread Peter Lund
From: Peter Lund [EMAIL PROTECTED] Negative shifts are not allowed in C (the result is undefined). It works on most platforms but not on the VAX with gcc 4.0.1 (it results in an operand reserved fault). Applies to Linux 2.6.22. Signed-off-by: Peter Lund [EMAIL PROTECTED] --- Shifting by more

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

2007-08-27 Thread Christoph Hellwig
On Sat, Aug 25, 2007 at 04:26:07PM +0200, Peter Firefly Lund wrote: > ([EMAIL PROTECTED] only bcc'ed because it's subscribers only, > Lameter addressed because I think he touched the code last, Velikov and > Hellwig because they touched the code first.) > > The current code in __max_index() will

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

2007-08-27 Thread Christoph Hellwig
On Sat, Aug 25, 2007 at 04:26:07PM +0200, Peter Firefly Lund wrote: ([EMAIL PROTECTED] only bcc'ed because it's subscribers only, Lameter addressed because I think he touched the code last, Velikov and Hellwig because they touched the code first.) The current code in __max_index() will shift

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

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

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

2007-08-25 Thread Peter Firefly Lund
([EMAIL PROTECTED] only bcc'ed because it's subscribers only, Lameter addressed because I think he touched the code last, Velikov and Hellwig because they touched the code first.) The current code in __max_index() will shift by a negative amount first and only then fix the situation by ignoring

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

2007-08-25 Thread Peter Firefly Lund
([EMAIL PROTECTED] only bcc'ed because it's subscribers only, Lameter addressed because I think he touched the code last, Velikov and Hellwig because they touched the code first.) The current code in __max_index() will shift by a negative amount first and only then fix the situation by ignoring