qemu/tests/qtest/libqos
Peter Maydell 0250edf1eb tests/qtest/libqos/ahci.c: Avoid NULL dereference in ahci_exec()
In ahci_exec() we attempt to permit the caller to pass a NULL pointer
for opts_in (in which case we use a default set of options).  However
although we check for NULL when setting up the opts variable at the
top of the function, we unconditionally dereference opts_in at the
end of the function as part of freeing the opts->buffer.

Switch to checking whether the final buffer is the same as the
buffer we started with, instead of assuming the value we started
with is always opts_in->buffer.

At the moment all the callers pass a non-NULL opts argument, so
we never saw any crashes in practice.

Fixes: Coverity CID 1432302
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201103115257.23623-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-11-03 09:42:54 -05:00
..
aarch64-xlnx-zcu102-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
ahci.c tests/qtest/libqos/ahci.c: Avoid NULL dereference in ahci_exec() 2020-11-03 09:42:54 -05:00
ahci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-imx25-pdk-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-n800-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-raspi2-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-sabrelite-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-smdkc210-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-virt-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-xilinx-zynq-a9-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
e1000e.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
e1000e.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
fw_cfg.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
fw_cfg.h boot-order-test: fix memleaks in boot-order-test 2020-02-04 09:00:57 +01:00
i2c-imx.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c-omap.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-pc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-spapr.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqtest.h qtest: remove qtest_qmp_receive_success 2020-10-12 11:50:49 -04:00
malloc-pc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc-spapr.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc.h tests/libqos: Move the libqos files under tests/qtest/ 2020-01-12 11:42:41 +01:00
meson.build meson: fix libqos linking 2020-09-08 07:17:09 +02:00
pci-pc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-spapr.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
ppc64_pseries-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qgraph_internal.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qgraph.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qgraph.h meson: link emulators without Makefile.target 2020-08-21 06:30:40 -04:00
qos_external.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qos_external.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
rtas.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
rtas.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
sdhci.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
sdhci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
tpci200.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
usb.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
usb.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-9p.c tests/9pfs: Force removing of local 9pfs test directory 2020-11-01 19:44:29 +01:00
virtio-9p.h tests/9pfs: make create/remove test dir public 2020-11-01 19:44:29 +01:00
virtio-balloon.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-balloon.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-blk.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-blk.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-mmio.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-mmio.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-net.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-net.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-pci-modern.c tests/libqos: Move the libqos files under tests/qtest/ 2020-01-12 11:42:41 +01:00
virtio-pci-modern.h tests/libqos: Move the libqos files under tests/qtest/ 2020-01-12 11:42:41 +01:00
virtio-pci.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-pci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-rng.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-rng.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-scsi.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-scsi.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-serial.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-serial.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
x86_64_pc-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00