- Aug 20, 2014
-
-
Markus Armbruster authored
g_new(T, n) is safer than g_malloc(sizeof(*v) * n) for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. Perhaps a conversion to g_malloc_n() would be neater in places, but that's merely four years old, and we can't use such newfangled stuff. This commit only touches allocations with size arguments of the form sizeof(T), plus two that use 4 instead of sizeof(uint32_t). We can make the others safe by converting to g_malloc_n() when it becomes available to us in a couple of years. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com> Reviewed-by:
Jeff Cody <jcody@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Markus Armbruster authored
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. Patch created with Coccinelle, with two manual changes on top: * Add const to bdrv_iterate_format() to keep the types straight * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle inexplicably misses Coccinelle semantic patch: @@ type T; @@ -g_malloc(sizeof(T)) +g_new(T, 1) @@ type T; @@ -g_try_malloc(sizeof(T)) +g_try_new(T, 1) @@ type T; @@ -g_malloc0(sizeof(T)) +g_new0(T, 1) @@ type T; @@ -g_try_malloc0(sizeof(T)) +g_try_new0(T, 1) @@ type T; expression n; @@ -g_malloc(sizeof(T) * (n)) +g_new(T, n) @@ type T; expression n; @@ -g_try_malloc(sizeof(T) * (n)) +g_try_new(T, n) @@ type T; expression n; @@ -g_malloc0(sizeof(T) * (n)) +g_new0(T, n) @@ type T; expression n; @@ -g_try_malloc0(sizeof(T) * (n)) +g_try_new0(T, n) @@ type T; expression p, n; @@ -g_realloc(p, sizeof(T) * (n)) +g_renew(T, p, n) @@ type T; expression p, n; @@ -g_try_realloc(p, sizeof(T) * (n)) +g_try_renew(T, p, n) Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Max Reitz <mreitz@redhat.com> Reviewed-by:
Jeff Cody <jcody@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Aug 19, 2014
-
-
Peter Maydell authored
This reverts commit b0225c2c (which breaks building with Xen enabled and also leaks memory). Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Peter Maydell authored
SCSI changes that enable sending vendor-specific commands via virtio-scsi. Memory changes for QOMification and automatic tracking of MR lifetime. # gpg: Signature made Mon 18 Aug 2014 13:03:09 BST using RSA key ID 9B4D86F2 # gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>" # gpg: aka "Paolo Bonzini <bonzini@gnu.org>" * remotes/bonzini/tags/for-upstream: mtree: remove write-only field memory: Use canonical path component as the name memory: Use memory_region_name for name access memory: constify memory_region_name exec: Abstract away ref to memory region names loader: Abstract away ref to memory region names tpm_tis: remove instance_finalize callback memory: remove memory_region_destroy memory: convert memory_region_destroy to object_unparent ioport: split deletion and destruction nic: do not destroy memory regions in cleanup functions vga: do not dynamically allocate chain4_alias sysbus: remove unused function sysbus_del_io qom: object: move unparenting to the child property's release callback qom: object: delete properties before calling instance_finalize virtio-scsi: implement parse_cdb scsi-block, scsi-generic: implement parse_cdb scsi-block: extract scsi_block_is_passthrough scsi-bus: introduce parse_cdb in SCSIDeviceClass and SCSIBusInfo scsi-bus: prepare scsi_req_new for introduction of parse_cdb Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Peter Maydell authored
* remotes/qmp-unstable/queue/qmp: monitor: fix use after free dump.c: Fix memory leak issue in cleanup processing for dump_init() monitor: Remove hardcoded watchdog event names Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Aug 18, 2014
-
-
Michael S. Tsirkin authored
The function monitor_fdset_dup_fd_find_remove() references member of 'mon_fdset' which - when remove flag is set - may be freed in function monitor_fdset_cleanup(). remove is set by monitor_fdset_dup_fd_remove which in practice does not need the returned value, so make it void, and return -1 from monitor_fdset_dup_fd_find_remove. Reported-by:
zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
Chen Gang authored
In dump_init(), when failure occurs, need notice about 'fd' and memory mapping. So call dump_cleanup() for it (need let all initializations at front). Also simplify dump_cleanup(): remove redundant 'ret' and redundant 'fd' checking. Signed-off-by:
Chen Gang <gang.chen.5i5j@gmail.com> Reviewed-by:
Laszlo Ersek <lersek@redhat.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
Hani Benhabiles authored
Signed-off-by:
Hani Benhabiles <hani@linux.com> Signed-off-by:
Luiz Capitulino <lcapitulino@redhat.com>
-
Peter Maydell authored
* remotes/amit/for-2.2: virtio-serial: search for duplicate port names before adding new ports virtio-serial: create a linked list of all active devices Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Amit Shah authored
Before adding new ports to VirtIOSerial devices, check if there's a conflict in the 'name' parameter. This ensures two virtserialports with identical names are not initialized. Reported-by:
<mazhang@redhat.com> Signed-off-by:
Amit Shah <amit.shah@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com>
-
Amit Shah authored
To ensure two virtserialports don't get added to the system with the same 'name' parameter, we need to access all the ports on all the devices added, and compare the names. We currently don't have a list of all VirtIOSerial devices added to the system. This commit adds a simple linked list in which devices are put when they're initialized, and removed when they go away. Signed-off-by:
Amit Shah <amit.shah@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com>
-
Peter Maydell authored
* remotes/mcayland/qemu-sparc: target-sparc64: implement Short Floating-Point Store Instructions apb: add IOMMU flush register implementation sun4u: switch second PCI-ebus bridge BAR over to PCI IO space Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Peter Maydell authored
Block pull request # gpg: Signature made Fri 15 Aug 2014 18:04:23 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: (55 commits) qcow2: fix new_blocks double-free in alloc_refcount_block() image-fuzzer: Reduce number of generator functions in __init__ image-fuzzer: Add generators of L1/L2 tables image-fuzzer: Add fuzzing functions for L1/L2 table entries docs: Expand the list of supported image elements with L1/L2 tables image-fuzzer: Public API for image-fuzzer/runner/runner.py image-fuzzer: Generator of fuzzed qcow2 images image-fuzzer: Fuzzing functions for qcow2 images image-fuzzer: Tool for fuzz tests execution docs: Specification for the image fuzzer ide: only constrain read/write requests to drive size, not other types virtio-blk: Correct bug in support for flexible descriptor layout libqos: Change free function called in malloc libqos: Correct mask to align size to PAGE_SIZE in malloc-pc libqtest: add QTEST_LOG for debugging qtest testcases ide: Fix segfault when flushing a device that doesn't exist qemu-options: add missing -drive discard option to cmdline help parallels: 2TB+ parallels images support parallels: split check for parallels format in parallels_open parallels: replace tabs with spaces in block/parallels.c ... Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Paolo Bonzini authored
ml->printed is never set to true. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
Rather than having the name as separate state. This prepares support for creating a MemoryRegion dynamically (i.e. without memory_region_init() and friends) and the MemoryRegion still getting a usable name. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
Despite being local to memory.c, use the helper function. This prepares support for fully QOMifiying the name field of MR (which will remove this state from MR completely). Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
It doesn't change the MR and some prospective call sites will have const MRs at hand. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
Use the function provided rather than spying on the struct. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Peter Crosthwaite authored
Use the function provided rather than spying on the struct. Signed-off-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
It is never used, since ISA device are not hot-unpluggable. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The function is empty after the previous patch, so remove it. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Explicitly call object_unparent in the few places where we will re-create the memory region. If the memory region is simply being destroyed as part of device teardown, let QOM handle it. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 17, 2014
-
-
Paolo Bonzini authored
Of the two functions portio_list_del and portio_list_destroy, the latter is just freeing a memory area. However, portio_list_del is the logical equivalent of memory_region_del_subregion so destruction of memory regions does not belong there. Actually, neither of these APIs are in use; portio is mostly used by ISA devices or VGAs, and neither of these is currently hot-unpluggable. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The memory regions should be destroyed in the unrealize function; since these NICs are not even qdev-ified, they cannot be unplugged and they do not have to do anything to destroy their memory regions. Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Instead, add a boolean variable to indicate the presence of the region. This avoids a repeated malloc/free (later we can also avoid the add_child/unparent by changing the offset/size of the alias). Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This ensures that the unparent callback is called automatically when the parent object is finalized. Note that there's no need to keep a reference neither in object_unparent nor in object_finalize_child_property. The reference held by the child property itself will do. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This ensures that the children's unparent callback will still have a usable parent. Reviewed-by:
Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Artyom Tarasenko authored
Implement Short Floating-Point Store Instructions as described in the chapter 13.5.2 of UltraSPARC-IIi User's Manual. Particularly this instructions are used by NetBSD 4.0.1+ /sparc64 Signed-off-by:
Artyom Tarasenko <atar4qemu@gmail.com> Signed-off-by:
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-
Mark Cave-Ayland authored
The IOMMU flush register is a write-only register used to remove entries from the hardware TLB. Allow guest writes to this register as a no-op, and return a value of 0 for reads. This fixes IOMMU DMA operations under NetBSD SPARC64. Signed-off-by:
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-
Mark Cave-Ayland authored
The ebus is the sun4u equivalent of the old ISA bus which is already mapped at the beginning of PCI IO space within QEMU. NetBSD attempts to find the physical addresses of devices connected to the ebus by parsing the BARs of the PCI-ebus bridge and using the base address found by matching both the address space type and range for a particular ebus address. Since the second PCI-ebus bridge BAR is already aliased onto IO space, switch the BAR over to match and reduce the size to 0x1000 which is enough to cover all the legacy ioport devices whilst leaving the remaining IO space for other PCI devices. This allows NetBSD SPARC64 to correctly detect and access devices on the ebus. Signed-off-by:
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-
- Aug 15, 2014
-
-
Peter Maydell authored
trivial patches for 2014-08-15 # gpg: Signature made Fri 15 Aug 2014 16:13:03 BST using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514 66A7 BEE5 9D74 A4C3 D7DB * remotes/mjt/tags/trivial-patches-2014-08-15: ivshmem: check the value returned by fstat() l2cap: fix access to freed memory intc: i8259: Convert Array allocation to g_new0 ppc: convert g_new(qemu_irq usages to g_new0 ssi: xilinx_spi: Initialise CS GPIOs as NULL vl: free err qemu-options.hx: fix typo about l2tpv3 vmxnet3: don't use 'Yoda conditions' vl: don't use 'Yoda conditions' spice: don't use 'Yoda conditions' don't use 'Yoda conditions' isa-bus: don't use 'Yoda conditions' audio: don't use 'Yoda conditions' usb: don't use 'Yoda conditions' CODING_STYLE: Section about conditional statement pci-host: update uncorresponding description pci-host: update obsolete reference about piix_pci.c qemu-options.hx: fix a typo of chardev memory: Update obsolete comment about AddrRange field type apic: Fix reported DFR content Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Stefan Hajnoczi authored
Commit de82815d ("qcow2: Handle failure for potentially large allocations") introduced a double-free of new_blocks in the alloc_refcount_block() error path. The qemu-iotests qcow2 026 test case was failing because qemu-io segfaulted. Make sure new_blocks is NULL after we free it the first time. Reviewed-by:
Kevin Wolf <kwolf@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
Some issues can be found only when a fuzzed image has a partial structure, e.g. has L1/L2 tables but no refcount ones. Generation of an entirely defined image limits these cases. Now the Image constructor creates only a header and a backing file name (if any), other image elements are generated in the 'create_image' API. Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
Entries in L1/L2 entries are based on a portion of random guest clusters. L2 entries contain offsets to host image clusters filled with random data. Clusters for L1/L2 tables and guest data are selected randomly. Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
__init__.py provides the public API required by the test runner Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
The layout submodule of the qcow2 package creates a random valid image, randomly selects some amount of its fields, fuzzes them and write the fuzzed image to the file. Fuzzing process can be controlled by an external configuration. Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Maria Kustova authored
The fuzz submodule of the qcow2 image generator contains fuzzing functions for image fields. Each fuzzing function contains a list of constraints and a call of a helper function that randomly selects a fuzzed value satisfied to one of constraints. For now constraints include only known as invalid or potentially dangerous values. But after investigation of code coverage by fuzz tests they will be expanded by heuristic values based on inner checks and flows of a program under test. Now fuzzing of a header, header extensions and a backing file name is supported. Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Maria Kustova <maria.k@catit.be> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-