[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH for 2.10 12/35] vfio/platform: fi
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory |
Date: |
Tue, 25 Jul 2017 17:37:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 24/07/2017 20:27, Philippe Mathieu-Daudé wrote:
> free the data _after_ using it.
>
> hw/vfio/platform.c:126:29: warning: Use of memory after it is freed
> qemu_set_fd_handler(*pfd, NULL, NULL, NULL);
> ^~~~
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/vfio/platform.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 = event_notifier_get_fd(intp->interrupt);
> qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp);
> ret = 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;
> }
>
>
Reviewed-by: Paolo Bonzini <address@hidden>
- [Qemu-trivial] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, (continued)
- [Qemu-trivial] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 08/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 09/35] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 13/35] vfio/pci: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 14/35] vfio/ccw: fix incorrect malloc() size, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 15/35] usb: correctly handle Zero Length Packets, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 19/35] usb/dev-mtp: fix use of uninitialized variable, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 20/35] arm/boot: fix undefined instruction on secondary smp cpu bootloader, Philippe Mathieu-Daudé, 2017/07/24