From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHFOr-0001TB-Uk for qemu-devel@nongnu.org; Sun, 06 Dec 2009 06:35:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHFOl-0001Qz-QD for qemu-devel@nongnu.org; Sun, 06 Dec 2009 06:35:35 -0500 Received: from [199.232.76.173] (port=47581 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHFOl-0001Qj-Ix for qemu-devel@nongnu.org; Sun, 06 Dec 2009 06:35:31 -0500 Received: from lo.gmane.org ([80.91.229.12]:43406) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NHFOl-0002dd-8s for qemu-devel@nongnu.org; Sun, 06 Dec 2009 06:35:31 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NHFOh-00025r-NG for qemu-devel@nongnu.org; Sun, 06 Dec 2009 12:35:27 +0100 Received: from 85.93.118.17 ([85.93.118.17]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Dec 2009 12:35:27 +0100 Received: from pbonzini by 85.93.118.17 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Dec 2009 12:35:27 +0100 From: Paolo Bonzini Date: Sun, 06 Dec 2009 12:35:04 +0100 Message-ID: References: <4B193DA5.6040507@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: Sender: news Subject: [Qemu-devel] Re: [PATCH] Permit zero-sized qemu_malloc() & friends List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 12/06/2009 11:22 AM, malc wrote: > Here, i believe, you are inventing artificial restrictions on how > malloc behaves, i don't see anything that prevents the implementor > from setting aside a range of addresses with 31st bit set as an > indicator of "zero" allocations, and then happily giving it to the > user of malloc and consumming it in free. But it has to make it a valid address anyway. If a zero-sized read treats it as invalid (SIGSEGV, EFAULT, whatever), malloc has failed to return a valid address and is not obeying its specification. Paolo