Messages in this thread | | | Date | Sat, 11 Jun 2011 14:01:35 +0200 | Subject | Re: [PATCH] m68k: Patch for broken lsl64() "old code" with incorrect shift | From | Geert Uytterhoeven <> |
| |
On Sat, Jun 11, 2011 at 05:50, Jonathan Elchison <JElchison@gmail.com> wrote: > In arch/m68k/math-emu/multi_arith.h, lsl64() doesn't calculate a > correct HI_WORD(*dest) when count < 32, due to an incorrect shift > operation. This line: > > HI_WORD(*dest) = (HI_WORD(*dest) << count) | (LO_WORD(*dest) >> count); > > ...should be... > > HI_WORD(*dest) = (HI_WORD(*dest) << count) | (LO_WORD(*dest) >> > (32 - count)); > > This function is ifdef'd out, marked as "old code". However, I fell > into the same trap into which I suspect others have fallen (or will > fall): On rare occasion when I need to implement my own library > functions, I depend on the Linux kernel to provide solid code. This > bug, albeit in old code, led me astray. > > I'm asking that this old code (lsl64) be corrected or removed.
I think it's better to just remove all #ifdefed out parts in the code.
> diff -up linux-2.6/arch/m68k/math-emu/multi_arith.h > linux-2.6_orig/arch/m68k/math-emu/multi_arith.h > --- linux-2.6/arch/m68k/math-emu/multi_arith.h 2011-06-10 > 22:50:32.538711320 -0400 > +++ linux-2.6_orig/arch/m68k/math-emu/multi_arith.h 2011-06-10 > 22:47:43.407285452 -0400 > @@ -236,7 +236,7 @@ static inline void lsl64(int count, unsi > { > if (count < 32) { > HI_WORD(*dest) = (HI_WORD(*dest) << count) > - | (LO_WORD(*dest) >> (32 - count)); > + | (LO_WORD(*dest) >> count); > LO_WORD(*dest) <<= count; > return; > }
The patch is reversed?
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- 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/
| |