Re: [PATCH] m68k: Patch for broken lsl64() "old code" with incorrect shift

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 11, 2011 at 05:50, Jonathan Elchison <JElchison@xxxxxxxxx> 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@xxxxxxxxxxxxxx

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-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux