[U-Boot] [PATCH V2] memcpy/memmove: Do not copy to same address

Scott Wood
2011-05-24T19:37:49Z

On Tue, 24 May 2011 00:22:49 +0200
Wolfgang Denk <wd@denx.de> wrote:

> Dear Alexander Holler,
>
> In message <4DDADBB6.30607@ahsoftware.de> you wrote:
> >
> > So you I will look forward to checks for NULL pointers and similiar in
> > all C standard functions implemented in u-boot to circumvent tons of
> > possible real world bugs in all callers of strcpy, strlen, mem* and
> > whatever.
>
> If you think a bit about this, you may find it more difficult than you
> expect. Keep in mind that on most systems supported by U-Boot code
> like
>
> int *p = (int *)0;
>
> print("*p = %d\n", *p);
>
> is perfectly legal and supposed to work without any problems -

Might want to pass -fno-delete-null-pointer-checks...

As for memcpy/memmove, if in U-Boot it's to be legal to pass overlapping
regions to memcpy(), why have separate implementations (not to mention
bcopy...)?

-Scott