From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Russ Date: Sat, 13 Nov 2010 12:51:12 +1100 Subject: [U-Boot] Commit ecee9... (Program net device MAC addresses after initializing) breakage In-Reply-To: <201011122011.43105.vapier@gentoo.org> References: <4CD5D2F4.5020102@gmail.com> <201011092236.41161.vapier@gentoo.org> <4CDD1D3B.1080703@gmail.com> <201011122011.43105.vapier@gentoo.org> Message-ID: <4CDDEF10.1030908@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 13/11/10 12:11, Mike Frysinger wrote: > On Friday, November 12, 2010 05:55:55 Graeme Russ wrote: >> On 10/11/10 14:36, Mike Frysinger wrote: >>> On Saturday, November 06, 2010 18:13:08 Graeme Russ wrote: >>>> I saw discussion a little while ago regarding implementing a version of >>>> malloc that returns cleared memory - did this gain any traction? >>> >>> i dont think anyone posted a patch. it would make sense though to >>> generalize the zalloc() code since some places are already doing it. >> >> Actually, I think we should be using calloc() more than we are > > if we want to define zalloc() to calloc(), then sure. but forcing people to > use calloc() with a size=1 is silly. the API is not nearly as obvious to > passing observers as zalloc(). Hmm, U-Boot has a zalloc in lib/gunzip.c which does not zero memory void *zalloc(void *x, unsigned items, unsigned size) { void *p; size *= items; size = (size + ZALLOC_ALIGNMENT - 1) & ~(ZALLOC_ALIGNMENT - 1); p = malloc (size); return (p); } and mtd has kzalloc defined thus: #define kzalloc(size, flags) calloc(size, 1) So there is some confusion surrounding 'zalloc' anyway ;) Regards, Graeme