From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2618 Path: news.gmane.org!not-for-mail From: Igmar Palsenberg Newsgroups: gmane.linux.lib.musl.general Subject: Re: malloc(0) behaviour Date: Tue, 15 Jan 2013 23:18:43 +0100 Message-ID: <46F585B5-5290-48F6-9A73-455FEBAEBDC5@palsenberg.com> References: <20130114180533.GP20323@brightrain.aerifal.cx> <1358254432.32505.26@driftwood> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1358288342 2205 80.91.229.3 (15 Jan 2013 22:19:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Jan 2013 22:19:02 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2619-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 15 23:19:20 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TvEqe-0006f7-EQ for gllmg-musl@plane.gmane.org; Tue, 15 Jan 2013 23:19:12 +0100 Original-Received: (qmail 18175 invoked by uid 550); 15 Jan 2013 22:18:55 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18167 invoked from network); 15 Jan 2013 22:18:55 -0000 In-Reply-To: <1358254432.32505.26@driftwood> X-Mailer: Apple Mail (2.1499) Xref: news.gmane.org gmane.linux.lib.musl.general:2618 Archived-At: >> > On 14/01/2013, Rich Felker wrote: >> > Another: Null means allocation failure. As malloc ought to never = fail >> > to find zero bytes free, it thus makes sense to return a non-null >> > pointer. >> A valid pointer also means you should be able to store something. >=20 > Says who? Fire up the mmap() man page and look at PROT_NONE. malloc() doesn't handle that case. I also find it irrelevant in this = case. You can only pass it to free() legally, everything else is UB. Igmar=