From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daQLQ-00020B-CQ for qemu-devel@nongnu.org; Wed, 26 Jul 2017 13:43:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daQLM-0001dH-El for qemu-devel@nongnu.org; Wed, 26 Jul 2017 13:43:36 -0400 Date: Wed, 26 Jul 2017 11:43:28 -0600 From: Alex Williamson Message-ID: <20170726114328.43416891@w520.home> In-Reply-To: <20170724182751.18261-13-f4bug@amsat.org> References: <20170724182751.18261-1-f4bug@amsat.org> <20170724182751.18261-13-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= Cc: Eric Blake , =?UTF-8?B?TWFyYy1BbmRyw6k=?= Lureau , qemu-devel@nongnu.org, qemu-trivial@nongnu.org On Mon, 24 Jul 2017 15:27:28 -0300 Philippe Mathieu-Daud=C3=A9 wrote: > free the data _after_ using it. >=20 > hw/vfio/platform.c:126:29: warning: Use of memory after it is freed > qemu_set_fd_handler(*pfd, NULL, NULL, NULL); > ^~~~ >=20 > Reported-by: Clang Static Analyzer > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > hw/vfio/platform.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c > index 7c09deda61..da84abf4fc 100644 > --- a/hw/vfio/platform.c > +++ b/hw/vfio/platform.c > @@ -120,11 +120,11 @@ static int vfio_set_trigger_eventfd(VFIOINTp *intp, > *pfd =3D event_notifier_get_fd(intp->interrupt); > qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp); > ret =3D ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set); > - g_free(irq_set); > if (ret < 0) { > error_report("vfio: Failed to set trigger eventfd: %m"); > qemu_set_fd_handler(*pfd, NULL, NULL, NULL); > } > + g_free(irq_set); > return ret; > } > =20 I'll snag this and 13/35 for a pull request with Paolo's R-b. Connie has already put a fix in for the other vfio related one, 14/35. Thanks! Alex