From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sun, 1 Apr 2012 16:21:45 +0200 Subject: [U-Boot] [PATCH] Prevent malloc with size 0 In-Reply-To: References: <4CC006B1.8000905@intracomdefense.com> <201204011601.56322.marek.vasut@gmail.com> Message-ID: <201204011621.46057.marek.vasut@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 Dear Joakim Tjernlund, > Marek Vasut wrote on 2012/04/01 16:01:56: > > Dear Joakim Tjernlund, > > > > > > Dear Mike Frysinger, > > > > > > > > > On Thursday, October 21, 2010 17:10:31 Graeme Russ wrote: > > > > > > On 22/10/10 06:51, Mike Frysinger wrote: > > > > > > > have u-boot return an error. > > > > > > > > > > > > Is NULL what you consider to be an error > > > > > > > > > > yes > > > > > > > > > > > Besides, is not free(NULL) valid (does nothing) as well? > > > > > > > > > > yes, free(NULL) should work fine per POSIX > > > > > -mike > > > > > > > > Well then, this patch wasn't accepted yet and I consider it OK to > > > > apply. Any objections? > > > > > > There was a long debate on the list regarding this where I argued that > > > malloc(0) should not be an error and malloc should return a ptr != NULL > > > I guess that is why it hasn't been applied. > > > > > > Jocke > > > > Ok, let's restart. Is there any objection why malloc(0) should not return > > NULL in uboot? > > Yes, read the thread to see why. Well I did, that's why I have no objections to applying this patch > > Is it coliding with any spec? > > No, both are valid. > > Jocke Best regards, Marek Vasut