From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAGS6-00047a-Qn for qemu-devel@nongnu.org; Wed, 02 Jan 2008 22:09:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JAGS4-00045U-Vp for qemu-devel@nongnu.org; Wed, 02 Jan 2008 22:09:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAGS4-00045I-QD for qemu-devel@nongnu.org; Wed, 02 Jan 2008 22:09:00 -0500 Received: from pop-sarus.atl.sa.earthlink.net ([207.69.195.72]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JAGS4-0002xS-F8 for qemu-devel@nongnu.org; Wed, 02 Jan 2008 22:09:00 -0500 Message-ID: <477C4F1E.2070506@earthlink.net> Date: Wed, 02 Jan 2008 21:57:34 -0500 From: Robert Reif MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix possible NULL pointer use in hw/ptimer.c References: <477C489C.1000208@earthlink.net> <200801030243.13180.paul@codesourcery.com> In-Reply-To: <200801030243.13180.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org Paul Brook wrote: >> s = (ptimer_state *)qemu_mallocz(sizeof(ptimer_state)); >>+ if (!s) >>+ return NULL; >> >> > >None of the callers bother to check the return value, And even if they did I >don't think there's any point trying to gracefully handle OOM. Just abort >and be done with it. > > I am in the process of fixing the sparc ptimer caller to gracefully handle OOM. 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?