From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAG3G-00048z-H2 for qemu-devel@nongnu.org; Wed, 02 Jan 2008 21:43:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JAG3D-00046G-VS for qemu-devel@nongnu.org; Wed, 02 Jan 2008 21:43:21 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAG3D-00046D-TB for qemu-devel@nongnu.org; Wed, 02 Jan 2008 21:43:19 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JAG3D-0007Yr-HY for qemu-devel@nongnu.org; Wed, 02 Jan 2008 21:43:19 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] fix possible NULL pointer use in hw/ptimer.c Date: Thu, 3 Jan 2008 02:43:10 +0000 References: <477C489C.1000208@earthlink.net> In-Reply-To: <477C489C.1000208@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200801030243.13180.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: qemu-devel@nongnu.org Cc: Robert Reif > =A0 =A0 =A0s =3D (ptimer_state *)qemu_mallocz(sizeof(ptimer_state)); > + =A0 =A0if (!s) > + =A0 =A0 =A0 =A0return NULL; None of the callers bother to check the return value, And even if they did = I=20 don't think there's any point trying to gracefully handle OOM. Just abort= =20 and be done with it. I suggest guaranteeing that qemu_malloc will never return NULL, and removin= g=20 the null checks from all the various users. Paul