From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NF6oj-0006Um-3j for qemu-devel@nongnu.org; Mon, 30 Nov 2009 09:01:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NF6oc-0006T3-Qd for qemu-devel@nongnu.org; Mon, 30 Nov 2009 09:01:28 -0500 Received: from [199.232.76.173] (port=33615 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NF6oc-0006Sz-KE for qemu-devel@nongnu.org; Mon, 30 Nov 2009 09:01:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40947) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NF6oc-0002wY-3j for qemu-devel@nongnu.org; Mon, 30 Nov 2009 09:01:22 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAUE1Lc4010301 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 Nov 2009 09:01:21 -0500 Message-ID: <4B13D02F.7040200@redhat.com> Date: Mon, 30 Nov 2009 16:01:19 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On 11/30/2009 03:55 PM, Markus Armbruster wrote: > Commit a7d27b53 made zero-sized allocations a fatal error, deviating > from ISO C's malloc()& friends. Revert that, but take care never to > return a null pointer, like malloc()& friends may do (it's > implementation defined), because that's another source of bugs. > > Rationale: while zero-sized allocations might occasionally be a sign of > something going wrong, they can also be perfectly legitimate. The > change broke such legitimate uses. We've found and "fixed" at least one > of them already (commit eb0b64f7, also reverted by this patch), and > another one just popped up: the change broke qcow2 images with virtual > disk size zero, i.e. images that don't hold real data but only VM state > of snapshots. > I strongly agree with this patch. A consistent API improves quality, especially when it is also consistent with people's expectations. -- error compiling committee.c: too many arguments to function