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

Scott Wood scottwood at freescale.com
Tue May 24 21:37:49 CEST 2011


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

> Dear Alexander Holler,
> 
> In message <4DDADBB6.30607 at 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



More information about the U-Boot mailing list