From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAReA-00083A-L8 for qemu-devel@nongnu.org; Thu, 03 Jan 2008 10:06:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JARe8-00082B-PO for qemu-devel@nongnu.org; Thu, 03 Jan 2008 10:06:14 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JARe8-000824-KJ for qemu-devel@nongnu.org; Thu, 03 Jan 2008 10:06:12 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JARe8-0007CV-B4 for qemu-devel@nongnu.org; Thu, 03 Jan 2008 10:06:12 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JAQh0-0006Zk-2Z for qemu-devel@nongnu.org; Thu, 03 Jan 2008 09:05:06 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] fix possible NULL pointer use in hw/ptimer.c Date: Thu, 3 Jan 2008 14:02:55 +0000 References: <477C489C.1000208@earthlink.net> <200801030243.13180.paul@codesourcery.com> <477C4F1E.2070506@earthlink.net> In-Reply-To: <477C4F1E.2070506@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801031402.57809.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Robert Reif Cc: qemu-devel@nongnu.org > We currently don't check the return value in the init function where the > new timer is created but do check it wherever it is used which is backwards > and wasteful. > > You would prefer that qemu just segfaults rather than die gracefully? I think qemu should die before it returns from qemu_malloc. Having to check every return value is extremely tedious and (as you've proved) easy to miss. If the allocation fails we don't have any viable alternatives, so we may as well stop right there. Paul