mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Jonathan Elchison <JElchison@gmail.com>
Cc: linux-m68k@vger.kernel.org, Jiri Kosina <trivial@kernel.org>,
	linux-kernel@vger.kernel.org,
	David Huggins-Daines <dhd@debian.org>
Subject: Re: [PATCH] m68k: Patch for broken lsl64() "old code" with incorrect shift
Date: Sat, 11 Jun 2011 14:01:35 +0200	[thread overview]
Message-ID: <BANLkTimz90oWNDYYNnpX5aDhJ192LhDkXA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimUSvQi9CPgO+cCUrEdQq-+ohbzFg@mail.gmail.com>

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

  reply	other threads:[~2011-06-11 12:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11  3:50 Jonathan Elchison
2011-06-11 12:01 ` Geert Uytterhoeven [this message]
2011-06-11 12:34   ` Jonathan Elchison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimz90oWNDYYNnpX5aDhJ192LhDkXA@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=JElchison@gmail.com \
    --cc=dhd@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®