Hi,

do you have some test case showing the behaviour?

best regards
 Waldemar

Petar Jovanovic wrote,

> Can somebody take a look at this and apply it?
> 
> Thank you.
> 
> Regards,
> Petar
> 
> On Mon, May 6, 2019 at 3:29 PM Petar Jovanovic
> <petar.jovano...@rt-rk.com> wrote:
> >
> > When arch (such as MIPS) does not define __ARCH_HAS_BWD_MEMCPY__, memmove()
> > calls memcpy() which is wrong for overlapping regions.
> >
> > Signed-off-by: Petar Jovanovic <petar.jovano...@rt-rk.com>
> > ---
> >  libc/string/generic/memmove.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c
> > index bf78c4778..1ac018013 100644
> > --- a/libc/string/generic/memmove.c
> > +++ b/libc/string/generic/memmove.c
> > @@ -23,7 +23,7 @@
> >  #include "memcopy.h"
> >  #include "pagecopy.h"
> >
> > -#ifdef __ARCH_HAS_BWD_MEMCPY__
> > +#ifndef __ARCH_HAS_BWD_MEMCPY__
> >  /* generic-opt memmove assumes memcpy does forward copying! */
> >  #include "_memcpy_fwd.c"
> >  #endif
> > @@ -224,8 +224,8 @@ void *memmove (void *dest, const void *src, size_t len)
> >       Reduces the working set.  */
> >    if (dstp - srcp >= len)      /* *Unsigned* compare!  */
> >      {
> > -#ifndef __ARCH_HAS_BWD_MEMCPY__
> > -      /* Backward memcpy implementation cannot be used */
> > +#ifdef __ARCH_HAS_BWD_MEMCPY__
> > +      /* Backward memcpy implementation can be used */
> >        memcpy(dest, src, len);
> >  #else
> >        /* Copy from the beginning to the end.  */
> > --
> > 2.17.1
> >
> 
_______________________________________________
devel mailing list
devel@uclibc-ng.org
https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to