Am 23.05.2011 23:55, schrieb Wolfgang Denk: > Dear Alexander Holler, > > In message<4ddacc8b.6090...@ahsoftware.de> you wrote: >> >>> --- a/lib/string.c >>> +++ b/lib/string.c >>> @@ -467,6 +467,9 @@ void * memcpy(void *dest, const void *src, size_t count) >>> unsigned long *dl = (unsigned long *)dest, *sl = (unsigned long *)src; >>> char *d8, *s8; >>> >>> + if (src == dest) >>> + return dest; >>> + >> >> here is the same, as in the patch I've commented before. There exist no >> reason to add a check for identity to memcpy() because memcpy doesn't >> support overlapping regions (and identity is just a special case of >> overlapping regions). If something might call memcpy() with overlapping >> or identical regions, it should use memmove(). > > In an ideal world, nobody will ever use any interfces in a > non-compliant or incorrect way. > > In reality, all kind of errors happen. A little defensive programming > like the one above helps a lot, so please stop complaining even if you > think you don't need this.
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. Reads promising, regards, Alexander _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot