From: Mike Frysinger Date: Mon, 23 May 2011 23:47:01 -0400 Subject: [U-Boot] [PATCH V2] memcpy/memmove: Do not copy to same address In-Reply-To: <4DDAE1F9.70008@ahsoftware.de> References: <1302591520-12517-1-git-send-email-weisserm@arcor.de> <20110523222249.76592CF5CA6@gemini.denx.de> <4DDAE1F9.70008@ahsoftware.de> Message-ID: <201105232347.02781.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, May 23, 2011 18:38:49 Alexander Holler wrote: > Am 24.05.2011 00:22, schrieb Wolfgang Denk: > > Alexander Holler 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 - > > because 0 is a legal address, and it makes perfect senze that commands > > like "md" or "cp" can be used to access it. In the result, strcpy(), > > strlen(), mem*() and whatever must beable to work on address 0 likeon > > any other address, too. > > I've never seen a valid use of strcpy() with a null-pointer in real > world programs, which we are talking about, except in bugs. i'm lazy and type "0" all the time for loading files, copying memory, displaying things, etc... in u-boot. i dont feel like retraining my finger muscle memory if i dont have to ;). -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20110523/8f2a1b98/attachment.pgp