[Top] [All Lists]

Re: Bug in memmove

To: "Maciej W. Rozycki" <>
Subject: Re: Bug in memmove
From: Ralf Baechle <>
Date: Sat, 23 Jun 2001 16:22:21 +0200
Cc: "Gleb O. Raiko" <>,
In-reply-to: <>; from on Fri, Jun 22, 2001 at 08:21:30PM +0200
References: <> <>
User-agent: Mutt/1.2.5i
On Fri, Jun 22, 2001 at 08:21:30PM +0200, Maciej W. Rozycki wrote:

> > It seems there is a bug in our memmove routine. The condition is rare
> > though, for example, memmove copies incorrectly, if src=5, dst=4, len=9.
> [...]
> > Two questions here. First, do we have a pattern that satisfies the
> > condition, i.e. is the bug showstopper? My guess, it's not. Second, does
> > somebody have ideas how to fix the bug? Well, I have, but want to hear
> > somebody else.
>  Here is a quick fix I developed after reading your report.  It fixes the
> case you described.  Now memcpy() is invoked only if there is no overlap
> at all -- the approach is taken from the Alpha port. 
>  The copy loop begs for optimization (the original memmove() bits do as
> well), but at least it works correctly.  The patch applies cleanly to
> 2.4.5 as of today. 
>  Ralf, I think it should get applied unless someone cooks up a better
> solution, i.e. optimizes it.  I'll optimize it myself, eventually, if no
> one else does, but don't hold your breath.

Applied to my working tree.  I'll commit it in a few hours once I found
time to implement the same fix for 2.2 and mips64.


<Prev in Thread] Current Thread [Next in Thread>